Linux连接mysql提示Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2)
Solution:
1. Modify the corresponding socket address in /etc/my.cnf
For example, the connection address set at the beginning:
scoekt = /temp/smysql.sock
You can socket
modify the address to: socket = /usr/mysql/mysql.sock
If this does not work, you can set it tosocket = /usr/mysql/mysqld.sock
2. Restart mysql
Stop MySQL: service mysqld stop
Start MySQL:service mysqld start
3. Make a remote connection again
ln -s /usr/local/mysql/mysql/mysqld.sock /usr/local/mysql/mysql.sock
4. Restart MySQL
Stop MySQL: service mysqld stop
Start MySQL:service mysqld start