MySQL5.5关闭数据库报错"Can't connect to local MySQL server through socket"怎么办

43次阅读
没有评论

共计 1538 个字符,预计需要花费 4 分钟才能阅读完成。

行业资讯    
数据库    
MySQL 数据库    
MySQL5.5 关闭数据库报错 Can t connect to local MySQL server through socket 怎么办

本篇内容介绍了“MySQL5.5 关闭数据库报错 Can t connect to local MySQL server through socket 怎么办”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让丸趣 TV 小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!

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 怎么办”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注丸趣 TV 网站,丸趣 TV 小编将为大家输出更多高质量的实用文章!

正文完
 
丸趣
版权声明:本站原创文章,由 丸趣 2023-08-01发表,共计1538字。
转载说明:除特殊说明外本站除技术相关以外文章皆由网络搜集发布,转载请注明出处。
评论(没有评论)