Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Software
User Name
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.


  Search this Thread
Old 10-24-2006, 02:00 PM   #1
Registered: Jul 2006
Location: Crisfield
Distribution: Slackware, CentOS, RedHat
Posts: 159

Rep: Reputation: 15
Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

Received this while trying to access a MySQL database within a PHP page

Slackware 10.1 kernel
mysql 5.0.26 (installed as binary) shared client modules built from source and installed seperately
apache 2.2.0 (built and installed from source. been working fine)
php 5.1.6 (built from source a while ago however it initially built with an old libmysqlclient at version 4.0.x. So I built it again using the new client libraries

I ran into the familiar password problem with an old mysql client and a new mysql database. I was confused becuase many posts mention it was a PHP 4.x problem. I had PHP 5.1.6. Once I realized that my PHP was compiled with an old mysqlclient library I decided to try and fix my install base instead of resetting the passowords in mysql with OLD_PASSWORD (which I had done before on another machine a long time ago). I did not want to do that this time.

I tried to recomplie my php using the binary install of mysql 5.0.26 but it did not seem to want to pickup the static libmysqlclient.a. I kept getting all sorts of configure errors.

So I decided to start from scratch (sort of) I downloaded mysql 5.0.26 source and only built the client libraries and installed them in /usr/local/mysql2

Then I rebuilt php 5.1.6 --with-mysql=/usr/local/mysql2.
All went well. I installed them in apache and checked with ldd to make sure the libphp.5 was built with and it was WOO HOO!

Ok so now I start up and I get this error:

Warning: mysql_connect() [function.mysql-connect]: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /usr/local/apache-2.2.0/htdocs/vegadns-0.9.10/src/connect.php on line 28

If i go on the command line and log in with the same username and credentials it works.

I am running apache as user apache.

Any ideas?



Last edited by cygnus-x1; 10-24-2006 at 02:09 PM.
Old 10-25-2006, 06:56 AM   #2
Registered: Jul 2006
Location: Italy
Distribution: Ubuntu 11.04, Debian, OS X
Posts: 71

Rep: Reputation: 16
Ok so now I start up and I get this error:
Do you mean that you start up MySQL? If not you can start it doing mysqld --user=[MYSQL-USER-NAME] as root.
Old 06-05-2008, 01:14 PM   #3
LQ Newbie
Registered: Mar 2006
Posts: 15

Rep: Reputation: 0
Looks like you have another MySQL installation you didn't get rid of completely.

Here is a command about how to fix it:

Last edited by imagined; 12-11-2008 at 11:47 PM.


mysql, slackware

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
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock welery Linux - Software 19 03-06-2014 07:19 AM
Buzilla issue: "Can't connect to local MySQL server through socket '/tmp/mysql.sock'" vitopn Linux - General 3 05-21-2007 10:13 AM
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
can't connect to mysql through socket '/tmp/mysql.sock' Boby Programming 2 05-23-2004 01:32 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:08 PM.

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
Open Source Consulting | Domain Registration