当我通过 php 脚本连接我的数据库时,它显示
Could not connect: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
用户名和密码是正确的。
的东西my.cnf
[client]
#password = your_password
port = 3306
socket = /data/mysql/mysql.sock
# Here follows entries for some specific programs
# The MySQL server
[mysqld]
port = 3306
socket = /data/mysql/mysql.sock
skip-external-locking
ps:我把它改成socket = /var/lib/mysql/mysql.sock
php脚本仍然说“/var/lib/mysql/mysql.sock”?。然后运行
mysqladmin -u root -p status
表明
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/var/lib/mysql/mysql.sock' exists!
service mysqld restart
mysqld: unrecognized service