Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 09-27-2008, 09:52 PM   #1
LQ Newbie
Registered: Sep 2008
Posts: 1

Rep: Reputation: 0
Frustration: Can't connect to local MySQL server through socket '/usr/local/mysql-5.0


I have absolutely no knowledge when it comes to this stuff. I asked godaddy (where I have my hosting) to help, but they just told me to google it. I uploaded my website onto godaddy's linux hosting and when I type in my url I get this error message:

Warning: mysql_connect() [function.mysql-connect]: Can't connect to local MySQL server through socket '/usr/local/mysql-5.0/data/mysql.sock' (2) in /home/content/m/y/p/mypetpeeves/html/framework/class.database.php on line 61
Can't connect to local MySQL server through socket '/usr/local/mysql-5.0/data/mysql.sock' (2)

Anyone have any ideas why this is happening and if there is a solution to it. Oh by the way, please make this simple for me, because I know NADA of the advanced language. Thanks so much for your help.

~Desperate and Frustrated
Old 09-27-2008, 11:20 PM   #2
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671
The first thing to check is that the mysql server is running. Can you ssh into the server? Do you know what distro it uses? On some distro's you can run "sudo /sbin/chkconfig mysql". If it is off, then run "sudo /sbin/chkconfig mysql 35" for RedHat, SuSE, Mandriva, etal. If the server is running Debian or Slackware, They use different run level numbers and don't use the chkconfig command.
If you aren't sure then run: "grep default /etc/inittab"
grep default /etc/inittab
# The default runlevel is defined here
# runlevel 0  is  System halt   (Do not use this for initdefault!)
# runlevel 6  is  System reboot (Do not use this for initdefault!)
This will tell you what the default run level is.
Make sure that mysql is running for the default run level at least. Reading the entire file, you can find which is the multiuser w/network and which is the multiuser w/network and X windows from the comments.

You can download the mysql manual from their website. Make sure you read the section on securing mysql. As you are hosting a website, you must make sure that the root account has a password. Don't assume that the hosting service has done this.

On all systems you can run "ps -A | grep mysql":
ps -A | grep mysql
 2988 ?        00:00:00 mysqld_safe
 3055 ?        01:06:48 mysqld
to check if the service is running.

I haven't run a debian based system since Corel Linux, which was years ago and I was a newbie at the time, so I'm afraid I don't know which run level each distro uses and whether you need to create a symbolic link in /etc/init.d/rc.X/ (where X is the run level) or if there is a more convenient tool to do this. Without knowing the distribution you are using, I would just be confusing you anyway with potentially unnecessary details.

Most distro's have a Services wizard where you can check if services are running, and enable them as well (in a GUI). This may be your first step.

Last edited by jschiwal; 09-27-2008 at 11:35 PM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. NoviceW Linux - Networking 17 09-17-2014 02:13 PM
ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. SpellChainz Linux - Software 3 06-28-2007 11:46 AM
mysql error Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. SpellChainz Linux - Newbie 1 06-23-2007 03:35 PM
mysql error Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. Dannux Linux - Software 3 03-24-2006 08:44 AM

All times are GMT -5. The time now is 12:19 AM.

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