I just installed MySQL on my machine, and I'm having some trouble with getting other programs to communicate with the server. The programs I'm having trouble with specifically are PHP and Dreamweaver. Both programs are giving me the error message "Can't connect to local MySQL server through socket '/var/mysql/mysql.sock' (2)."
There are a number of problems here and I'm not really sure how to deal with them. The first is that there's no /var/mysql directory on my machine. I don't think (I'm not 100% sure) that the _mysql user has write privileges to the /var directory, so I don't know how it's supposed to create this mysql.sock socket. However, even if I create the /var/mysql directory and give the _mysql user write privileges, I still get the same error message.
I note that I can connect to the mysqld process just fine using the mysql command line application. In the configuration file /etc/my.cnf, I have the socket set to /tmp/mysql.sock:
# The following options will be passed to all MySQL clients
[client]
#password = your_password
port = 3306
socket = /tmp/mysql.sock
# Here follows entries for some specific programs
# The MySQL server
[mysqld]
port = 3306
socket = /tmp/mysql.sock
I didn't make any changes to the /my-medium.cnf file when I copied it over to /etc/my.cnf. I tried changing on both the client and mysqld parts of the configuration file socket = /var/mysql/mysql.sock but that didn't help.
If it matters, I'm actually running mysqld_safe and not mysqld:
$ sudo ./bin/mysqld_safe
Password:
Starting mysqld daemon with databases from /usr/local/mysql-5.0.51a-o
sx10.5-x86
/data
^Z
[1]+ Stopped sudo ./bin/mysqld_safe
$ bg
[1]+ sudo ./bin/mysqld_safe &
$ /usr/local/mysql/bin/mysql
-uroot -psecret
Welcome to the MySQL monitor. Commands end with ; or \g.
I know it's possible to change the MYSQL_SOCKET location in PHP, but I don't know how (or if it's possible) to change the analogous variable with regards to Dreamweaver. Any ideas of what to do would be greatly appreciated.
Start Free Trial