一、錯(cuò)誤日志:
[MySQL@host-172-24-115-217 ~]$ service mysql restart
Shutting down MySQL.. SUCCESS!
Starting MySQL..180426 13:36:03 mysqld_safe Logging to '/usr/local/mysql/data/alert.log'.
180426 13:36:03 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
.................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................. ERROR!
二、分析日志:
(1)查看日志
usr/local/mysql/data/alert.log
發(fā)現(xiàn):Version: '5.5.59-MariaDB' socket: '/usr/local/mysql/data/mysql.sock' port: 3306 MariaDB Server
表示mysqld 啟動(dòng)完畢。
(2)查看進(jìn)程
[mysql@host-172-24-115-217 fd]$ ps -ef | grep mysqld
mysql 20633 1 0 13:36 pts/5 00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/usr/local/mysql/data --pid-file=/usr/local/mysql/data/mysqlProcess.pid
mysql 21736 20633 0 13:36 pts/5 00:00:02 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --log-error=/usr/local/mysql/data/alert.log --pid-file=/usr/local/mysql/data/mysqlProcess.pid --socket=/usr/local/mysql/data/mysql.sock --port=3306
mysql 22436 7333 0 13:40 pts/3 00:00:00 grep mysqld
分析:
從日志和進(jìn)程信息可以看出此mysqld服務(wù)正常。那為什么出現(xiàn)啟動(dòng)失敗的現(xiàn)象。
三、挖掘原因
既然mysqld服務(wù)進(jìn)程正常,那從其它機(jī)器是否可以登錄。經(jīng)過測(cè)試
[mysql@host-172-24-115-218 ~]$ mysql -h272.24.115.217 -uroot -pmysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 1
Server version: 5.5.59-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>
經(jīng)過驗(yàn)證,可以登錄。
四:結(jié)論
從此可以推斷
mysql
服務(wù)器的client配置錯(cuò)誤,導(dǎo)致mysql進(jìn)程讀取配置導(dǎo)致異常
檢查/etc/my.cnf 發(fā)現(xiàn)如下:
[client]
#socket = /usr/local/mysql/data/mysql.sock
default-character-set = gbk
port = 3306
缺少紅色部分,注釋后,再次重啟一切正常。
希望改進(jìn):
希望mysql的啟動(dòng)過程相關(guān)的shell腳本也能添加相應(yīng)的日志,協(xié)助分析問題。
That is all.
Good Luck!
網(wǎng)站名稱:MySQL啟動(dòng)失敗
文章轉(zhuǎn)載:
http://weahome.cn/article/igeopc.html