MySQL服务器意外关机-无法启动多实例
就在刚刚,MySQL服务器意外掉电关机-设备启动后,无硬件报错,无法启动多实例
创新互联主要从事成都做网站、成都网站制作、网页设计、企业做网站、公司建网站等业务。立足成都服务上海,10年网站建设经验,价格优惠、服务专业,欢迎来电咨询建站服务:18982081108
[root@db02 ~]# mysql -uroot -S /data/3306/mysql.sock ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/data/3306/mysql.sock' (111) ##无法连接到本地mysql socket ##
查看日志:没有记录error
尝试启动mysql 服务,失败[root@db02 ~]# /data/3306/mysql start MySQL is running... [root@db02 ~]# ps -ef|grep msyql #但mysql进程并没有启动 root 1327 1273 0 13:25 pts/0 00:00:00 grep --color=auto msyql [root@db02 ~]#
然后想起mysql启动原理,就是通过mysql启动脚本,然后调用 mysqld_safe 脚本,最后调用mysqld主进程,启动mysql服务,生成socket文件,所以我去根目录查看,发现服务没有启动 但有个socket文件
修复mysql
[root@db02 3306]# ls /data/3306/data mysql mysql-bin.000002 mysql-bin.index mysql_oldboy3306.errmy.cnf mysql-bin.000001 mysql-bin.000003 mysqld.pid mysql.sock ##怀疑是刚才意外关机,msyql服务卡死,造成sock文件没有移除,所以考虑将sock改名或移动到/tmp [root@db02 3306]# cp /data/3306/mysql.sock{,.bak} #将sock文件移除
开启MySQL服务
[root@db02 3306]# /data/3306/mysql start #开启mysql服务 Starting MySQL... [root@db02 3306]# ps -ef|grep mysql #启动正常 root 1363 1 0 13:31 pts/0 00:00:00 /bin/sh /application/mysql/bin/mysqld_safe --defaults-file=/data/3306/my.cnf mysql 2087 1363 3 13:31 pts/0 00:00:00 /application/mysql-5.5.32/bin/mysqld --defaults-file=/data/3306/my.cnf --basedir=/application/mysql --datadir=/data/3306/data --plugin-dir=/application/mysql/lib/plugin --user=mysql --log-error=/data/3306/mysql_oldboy3306.err --open-files-limit=1024 --pid-file=/data/3306/mysqld.pid --socket=/data/3306/mysql.sock --port=3306 root 2106 1273 0 13:31 pts/0 00:00:00 grep --color=auto mysql
开启MySQL多实例
[root@db02 3306]# mysql -uroot -p -S /data/3306/mysql.sock Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.5.32-log Source distribution Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>
到此为止,恢复正常。
分享题目:MySQL服务器意外关机-无法启动多实例
网站网址:http://myzitong.com/article/josgid.html