连接mysql出现2002错误 在执行mysql命令的过程中,有时候会碰到如下的错误: shell mysqldump -uroot -p123456 -d jact jact.sql?? mysqldump: Got error: 2002: Can't connect to local MySQL server through socket '/usr/local/mysql/var/mysql.sock' (2)
连接mysql出现2002错误在执行mysql命令的过程中,有时候会碰到如下的错误:
shell> mysqldump -uroot -p123456 -d jact > jact.sql??
mysqldump: Got error: 2002: Can't connect to local MySQL server through socket '/usr/local/mysql/var/mysql.sock' (2) when trying to connect
说明我们使用的连接mysql的unix套接字错误。
要找出套接字的地点,应:
shell> netstat -ln | grep mysql
unix? 2????? [ ACC ]???? STREAM???? LISTENING???? 7414? /var/lib/mysql/mysql.sock
然后敲入如下命令:
shell> mysqldump --socket=/var/lib/mysql/mysql.sock -h 127.0.0.1 -uroot -p123456 -d jact > jact.sql
转载:http://blog.163.com/yj_yuan/blog/static/11084272011111541931484/