標籤:mysql無法啟動 socket異常
就在剛剛,MySQL伺服器意外掉電關機-裝置啟動後,無硬體報錯,無法啟動多執行個體
[[email protected] ~]# 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 服務,失敗
[[email protected] ~]# /data/3306/mysql startMySQL is running...[[email protected] ~]# ps -ef|grep msyql #但mysql進程並沒有啟動root 1327 1273 0 13:25 pts/0 00:00:00 grep --color=auto msyql[[email protected] ~]#
然後想起mysql啟動原理,就是通過mysql啟動指令碼,然後調用 mysqld_safe 指令碼,最後調用mysqld主進程,啟動mysql服務,產生socket檔案,所以我去根目錄查看,探索服務沒有啟動 但有個socket檔案
修複mysql
[[email protected] 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[[email protected] 3306]# cp /data/3306/mysql.sock{,.bak} #將sock檔案移除
開啟MySQL服務
[[email protected] 3306]# /data/3306/mysql start #開啟mysql服務Starting MySQL...[[email protected] 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.cnfmysql 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=3306root 2106 1273 0 13:31 pts/0 00:00:00 grep --color=auto mysql
開啟MySQL多執行個體
[[email protected] 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 2Server version: 5.5.32-log Source distributionCopyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.mysql>
到此為止,恢複正常。
本文出自 “逗哥筆記” 部落格,請務必保留此出處http://qiuyt.blog.51cto.com/1229789/1921117
MySQL伺服器意外關機-無法啟動多執行個體