故障背景,多實例在運行一段時間後,有天啓動機器後,檢查發現兩個實例都沒啓動
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形成的,因此,管好機器,養成良好維護習慣!!進程