Home > Database > Mysql Tutorial > 连接mysql出现2002异常

连接mysql出现2002异常

WBOY
Release: 2016-06-07 16:16:07
Original
1878 people have browsed it

连接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/

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template