在一次服务器重启后就无法启动mysql了

[[email protected] mysql]# service mysqld start
/usr/bin/mysqld_safe: line 183:  6408 Killed                  nohup /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock < /dev/null > /dev/null 2>&1
MySQL Daemon failed to start.
Starting mysqld:                                           [FAILED]

打开mysql的log看看报错

[[email protected] mysql]# vim /var/log/mysqld.log

2018-09-21 06:22:49 3489 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED'
2018-09-21 06:22:49 3489 [Note] Shutting down plugin 'INNODB_FT_DELETED'
2018-09-21 06:22:49 3489 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD'
2018-09-21 06:22:49 3489 [Note] Shutting down plugin 'INNODB_METRICS'
2018-09-21 06:22:49 3489 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
2018-09-21 06:22:49 3489 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
2018-09-21 06:22:49 3489 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE'
2018-09-21 06:22:49 3489 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET'
2018-09-21 06:22:49 3489 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX'
2018-09-21 06:22:49 3489 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET'
2018-09-21 06:22:49 3489 [Note] Shutting down plugin 'INNODB_CMPMEM'
2018-09-21 06:22:49 3489 [Note] Shutting down plugin 'INNODB_CMP_RESET'
2018-09-21 06:22:49 3489 [Note] Shutting down plugin 'INNODB_CMP'
2018-09-21 06:22:49 3489 [Note] Shutting down plugin 'INNODB_LOCK_WAITS'
2018-09-21 06:22:49 3489 [Note] Shutting down plugin 'INNODB_LOCKS'
2018-09-21 06:22:49 3489 [Note] Shutting down plugin 'INNODB_TRX'
2018-09-21 06:22:49 3489 [Note] Shutting down plugin 'ARCHIVE'
2018-09-21 06:22:49 3489 [Note] Shutting down plugin 'BLACKHOLE'
2018-09-21 06:22:49 3489 [Note] Shutting down plugin 'CSV'
2018-09-21 06:22:49 3489 [Note] Shutting down plugin 'MEMORY'
2018-09-21 06:22:49 3489 [Note] Shutting down plugin 'MRG_MYISAM'
2018-09-21 06:22:49 3489 [Note] Shutting down plugin 'MyISAM'
2018-09-21 06:22:49 3489 [Note] Shutting down plugin 'sha256_password'
2018-09-21 06:22:49 3489 [Note] Shutting down plugin 'mysql_old_password'
2018-09-21 06:22:49 3489 [Note] Shutting down plugin 'mysql_native_password'
2018-09-21 06:22:49 3489 [Note] Shutting down plugin 'binlog'
2018-09-21 06:22:49 3489 [Note] /usr/sbin/mysqld: Shutdown complete

都是上一次关机的note 没卵用
然后去phpmyadmin碰碰运气看看有没有其他错误信息 还真有...

mysqli_real_connect(): (HY000/2002): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

好吧 mysql.sock没了 然后顺手到my.cnf看看除了mysql.sock之外还有一个mysqld.pid也是没有了
既然我启动的时候他不会自己生产那唯有手动生成了
首先确认这两个文件所在的目录权限所属用户和组都是mysql
然后直接到目录里分别touch mysql.socktouch mysqld.pid
记得加权限 chown mysql:mysql mysql.sockchwon mysql:mysql mysqld.pid

最后

[[email protected] mysql]# service mysqld start
Starting mysqld:                                           [  OK  ]

打完收工

标签: none

添加新评论