Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] Socket error when connecting to MySQL



Josh,

I've resolved the Zend studio/MySQL socket issue by creating a symbolic link from /tmp/mysql.sock to /var/run/mysqld/mysqld.sock.
( ln -s /var/run/mysqld/mysql.sock /tmp/mysql.sock )

But, clearly in my earlier attempts to find a solution, I've munged up my php.ini file or something, because now not only does phpMyAdmin not connect, no PHP script that I run locally will work.

To resolve this, I tried to retrace my steps and put everything back the way it was. I also reinstalled MySQL, PHP, and phpMyAdmin from the Ubuntu repositories using apt-get.

Despite these efforts, whatever it is that I've done to mess up my system remains in place.

When I start a PHP script that calls upon MySQL, I get the following error:
Warning: mysql_pconnect() [function.mysql-pconnect]: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /web_sites/web/db_fns.php on line 6.

So far as I can remember, the only places I made edits were in /etc/php5/apache2/php.ini, and /etc/mysql/my.cnf.

In /etc/php5/apache2/php.ini, here is what the relevant section looks like now:

- - - - - - - - -
; Default port number for mysql_connect(). If unset, mysql_connect() will use
; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the
; compile-time value defined MYSQL_PORT (in that order). Win32 will only look
; at MYSQL_PORT.
mysql.default_port = 3306

; Default socket name for local MySQL connects.  If empty, uses the built-in
; MySQL defaults.
mysql.default_socket =
- - - - - - - - -

My understanding of the above is that if the socket variable is left empty, it should go with the MySQL default. I have tried specifying "mysql.default_socket = /var/run/mysqld/mysql.sock" and "mysql.default_socket = /tmp/mysql.sock", but that hasn't helped.

As for /etc/mysql/my.cnf, it says:

- - - - - - - - -
[mysqld]
pid-file    = /var/run/mysqld/mysqld.pid
socket     = /var/run/mysqld/mysql.sock
- - - - - - - - -

I am unsure where to look to diagnose this problem further.

Any idea on where I might have messed up?

--
Dave M G


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links