LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 12-24-2017, 12:32 PM   #1
sbrown1038
LQ Newbie
 
Registered: Feb 2004
Location: New Windsor, New York, Hudson Valley
Distribution: Red Hat, Fedora Core, Linux Mint, CentOS
Posts: 12

Rep: Reputation: 0
Change default location for MySQL


I had 3 installations of MySQL on my Linux server (my laptop):

1. Downloaded from MySQL.org.
2. Installed and later removed with apt-get.
3. Installed with Ampps LAMP stack bundle.

My goal is to set up a Drupal 8 site. Since I was getting errors, I thought it best to remove the MySQL that was already there, so I did so with apt-get remove. Apparently, doing this left the downloaded install in an unusable state. Any app (Drupal and PHPMyAdmin, for example) that tries to use it gets an error:

Failed to connect to your database server. The server reports the following message: SQLSTATE[HY000] [2002] No such file or directory.


Trying to start the MySQL client from a command line, I get this:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)


If I include the full path to the Ampps copy of MySQL, the client works fine.

So my question is, how do I make the Ampps copy of MySQL the default so that applications that look for MySQL find that one instead of the other one?

Any help would be truly appreciated.

Steve
 
Old 12-24-2017, 02:32 PM   #2
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,727

Rep: Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211
Either add the full path of the Ampps copy of MySQL to your PATH (in your ~/.bash_profile or ~/.bashrc, if using bash shells -- post shell you're using if not bash)
or
link to the Ampps copy pf MySQL in the directory your system expects to find it. Mine is in /bin
the link is probably the more universal solution if other users need access to mysql.

Last edited by scasey; 12-24-2017 at 02:33 PM.
 
1 members found this post helpful.
Old 12-25-2017, 03:04 PM   #3
sbrown1038
LQ Newbie
 
Registered: Feb 2004
Location: New Windsor, New York, Hudson Valley
Distribution: Red Hat, Fedora Core, Linux Mint, CentOS
Posts: 12

Original Poster
Rep: Reputation: 0
SOLVED

As suggested, I added the full path of the Ampps installation to my .bashrc file. I also renamed mysql in the /usr/bin directory and created a link there to /usr/local/ampps/mysql/bin/mysql. At that point, I could get into the mysql client from any directory without including the ampps path. However, I still got the error message from the Drupal install. Since the error message mentioned /var/run/mysqld.sock, which didn't exist, I created a link for that to /usr/local/ampps/var/mysql.sock (no 'd'). The error message went away. I expect I'll run into other problems, but for now it seems I'll be able to get started with the Drupal site.

=== 12/28/2017 ADDITIONAL INFO ===

Whenever I rebooted, the link from /var/run/mysqld.sock to /usr/local/ampps/var/mysql.sock would disappear (as it's supposed to). To fix this, I added 2 lines near the top of /etc/init.d/mysqld (actually a link to the ampps startup file, /usr/local/ampps/mysql/bin/mysqlctl):

mkdir /var/run/mysqld
ln -s /usr/local/ampps/var/mysql.sock /var/run/mysqld/mysqld.sock

And with that, my "Frankenstein" LAMP stack seems to be working well. I've got my Drupal 8 site up and I can work with PHPMyAdmin.

==================================

Thanks for your help, Sean and Merry Christmas / Happy Holidays!

Steve

Last edited by sbrown1038; 12-28-2017 at 10:14 AM.
 
  


Reply

Tags
mysql



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Change Default Home Directory Location NotAComputerGuy Linux - Newbie 4 07-17-2013 06:22 AM
need to change IPtables default location ringque Linux - Software 2 05-22-2011 12:35 AM
Change the default location of mysql database files ziggy25 Linux - Software 3 08-18-2009 01:17 PM
How to change default location in flight gear sirius57 Linux - Software 0 11-24-2008 09:21 PM
how to change the default mail delivery location mnisski Linux - General 3 10-21-2003 08:59 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:50 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration