本篇内容介绍了“MySQL5.5关闭数据库报错"Can't connect to local MySQL server through socket"怎么办”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!
MySQL 5.5 关闭数据库报错
[root@localhost ~]# /software/bin/mysqladmin -usystem -p'system' shutdown
/software/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/cluster_data/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/cluster_data/mysql.sock' exists!
报错原因:
数据库之前使用过其他的socket
解决方法:
关闭数据库命令参数中,指定现有的socket名字
查看现有的socket
[root@localhost ~]# ps -ef|grep mysql
root 2487 2462 0 08:13 ? 00:00:00 /bin/sh /software/bin/mysqld_safe --defaults-file=/mysql_data/cnf/my.cnf
mysql 3057 2487 0 08:14 ? 00:00:00 /software/bin/mysqld --defaults-file=/mysql_data/cnf/my.cnf --basedir=/software --datadir=/mysql_data/70005 --plugin-dir=/software/lib/plugin --user=mysql --log-error=/mysql_log/err.log --open-files-limit=10240 --pid-file=/mysql_data/70005/mysqld.pid --socket=/mysql_data/70005/mysql.sock --port=55057
root 3092 3026 0 08:14 pts/1 00:00:00 grep mysql
[root@localhost ~]# /software/bin/mysqladmin -?|grep sock
--protocol=name The protocol to use for connection (tcp, socket, pipe,
-S, --socket=name The socket file to use for connection.
socket /cluster_data/mysql.sock
正常关闭数据库
[root@localhost ~]# /software/bin/mysqladmin -usystem -p'system' shutdown --socket=//mysql_data/70005/mysql.sock
“MySQL5.5关闭数据库报错"Can't connect to local MySQL server through socket"怎么办”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注亿速云网站,小编将为大家输出更多高质量的实用文章!