Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'解決,mysqldmysqld.sock
安裝上mysql後,報 Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock',試了網上的方法都沒有用,於是打開/etc/my.cnf查看。
看到這麼一段:
# The MySQL server
26 [mysqld]
27 port = 3306
28 socket = /tmp/mysql.sock
29 skip-external-locking
30 log-error=/alidata/log/mysql/error.log
31 key_buffer_size = 16M
32 max_allowed_packet = 1M
33 table_open_cache = 64
34 sort_buffer_size = 512K
35 net_buffer_length = 8K
36 read_buffer_size = 256K
37 read_rnd_buffer_size = 512K
38 myisam_sort_buffer_size = 8M
可知,使用的.sock文件,是/tmp/mysql.sock,而不是/var/run/mysqld/mysqld.sock,於是加個鏈接
ln -s /tmp/mysql.sock /var/run/mysqld/mysqld.sock
解決