Page 1 of 1

Error connecting to DB.

Posted: Wed Aug 28, 2002 9:56 am
by xLechugasx
Hi to all!!
My name is Nicolas and I am a new user of PHP and MySQL.
I am having the following error while trying to connect to a mysql database:

Can't connect to local MySQL server through socket '/tmp/mysql.sock'

I wrote the name and password ok, and in the host argument for the mysql_connect function I used localhost.

What can be wrong?
Thanks a lot,
Nicolas

mysql running?

Posted: Wed Aug 28, 2002 10:02 am
by kcomer
is mysql running?

Posted: Wed Aug 28, 2002 10:04 am
by volka
mysql uses two ways to connect to a server
1) TCP as all know
2) sockets that are connected more like pipes

(2) is your problem

did you change mysql.default_socket in php.ini?

Posted: Wed Aug 28, 2002 10:28 am
by xLechugasx
This is what is shown with phpinfo().
MySQL is running.

mysql
MySQL Support enabled
Active Persistent Links 0
Active Links 0
Client API version 3.23.49a
MYSQL_MODULE_TYPE external
MYSQL_SOCKET /tmp/mysql.sock
MYSQL_INCLUDE -I/usr/local/mysql/include
MYSQL_LIBS -L/usr/local/mysql/lib -lmysqlclient

what can I do??

Posted: Wed Aug 28, 2002 7:49 pm
by volka
I'm not quite sure about this, but if you take a look in your mysqld-configuration (default is: my.cnf) you will find a parameter
[mysqld]
...
socket = /var/run/mysqld/mysqld.sock
whatever "socket" is set to, set it in the php.ini, too