故障背景,多实例在运行一段时间后,有天启动机器后,检查发现两个实例都没启动
mysql
一、检查实例是否启动:sql
[root@mysql-slave ~]# netstat -ntulp | grep 330 没任何输出 [root@mysql-slave ~]# ps -aux | grep mysqld mysqld进程没启动 Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.8/FAQ root 2544 0.0 0.0 103252 832 pts/0 S+ 18:08 0:00 grep mysqld
二、手工启动试试shell
[root@mysql-slave ~]# /db/3306/mysqld start 提示mysql已经正在运行(这不扯淡吗!!!) MySQL is running...
三、解决方法tcp
[root@mysql-slave ~]# rm -rf /db/3306/tmp/mysql.sock 删除mysql.sock和mysql.pid文件 [root@mysql-slave ~]# rm -rf /db/3306/*.pid [root@mysql-slave ~]# rm -rf /db/3307/tmp/mysql.sock [root@mysql-slave ~]# rm -rf /db/3307/*.pid
四、再次尝试启动code
[root@mysql-slave ~]# /db/3306/mysqld start Starting MySQL... [root@mysql-slave ~]# /db/3307/mysqld start Starting MySQL... [root@mysql-slave ~]# netstat -ntulp | grep 330 启动成功 tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 3253/mysqld tcp 0 0 0.0.0.0:3307 0.0.0.0:* LISTEN 3956/mysqld [root@mysql-slave ~]# mysql -uroot -pq.1234 -S /db/3306/tmp/mysql.sock 欧了!!! Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.5.37-log Source distribution Copyright (c) 2000, 2014, 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形成的,因此,管好机器,养成良好维护习惯!!进程