MySQL數據庫出現The server quit without updating PID file.

LNMP1.0能夠在Linux系統下快速搭建PHP環境,之前操做其它服務器也用過LNMP環境,重未出現過相似錯誤,現將解決過程記錄一下。html

1、服務器環境mysql

  操做系統:CentOS-6.4linux

  服務器環境:集成環境LNMP1.0sql

2、步驟重現數據庫

  一、安裝LNMP1.0,具體操做方法見這裏,安裝成功;服務器

  二、因我的需求,現將MySQL數據庫存放在/data/mysql/var,修改/etc/my.cnf的datadir=/data/mysql/var,別忘了將/var目錄的權限設置爲chown -R mysql.mysql /data/mysql; dom

  三、重啓服務,/root/lnmp restart;socket

  四、提示錯誤:Starting MySQL...The server quit without updating PID file [失敗]/mysql/var/localhost.localdomain.pid).;ui

3、解決錯誤atom

  一、根據提示多是PID的錯誤,按照常規解決方法kill相關進程、清除selinux,問題仍然存在;

  二、查看錯誤日誌,/usr/local/mysql/var/localhost.localdomain.pid

140513 11:59:34 mysqld_safe Starting mysqld daemon with databases from /data/mysql/var
/usr/local/mysql/bin/mysqld: Table 'mysql.plugin' doesn't exist
140513 11:59:34 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
140513 11:59:34 InnoDB: The InnoDB memory heap is disabled
140513 11:59:34 InnoDB: Mutexes and rw_locks use GCC atomic builtins
140513 11:59:34 InnoDB: Compressed tables use zlib 1.2.3
140513 11:59:34 InnoDB: Initializing buffer pool, size = 16.0M
140513 11:59:34 InnoDB: Completed initialization of buffer pool
InnoDB: The first specified data file /data/mysql/var/ibdata1 did not exist:
InnoDB: a new database to be created!
140513 11:59:34  InnoDB: Setting file /data/mysql/var/ibdata1 size to 10 MB
InnoDB: Database physically writes the file full: wait...
140513 11:59:34  InnoDB: Log file /data/mysql/var/ib_logfile0 did not exist: new to be created
InnoDB: Setting log file /data/mysql/var/ib_logfile0 size to 5 MB
InnoDB: Database physically writes the file full: wait...
140513 11:59:34  InnoDB: Log file /data/mysql/var/ib_logfile1 did not exist: new to be created
InnoDB: Setting log file /data/mysql/var/ib_logfile1 size to 5 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Doublewrite buffer not found: creating new
InnoDB: Doublewrite buffer created
InnoDB: 127 rollback segment(s) active.
InnoDB: Creating foreign key constraint system tables
InnoDB: Foreign key constraint system tables created
140513 11:59:35  InnoDB: Waiting for the background threads to start
140513 11:59:36 InnoDB: 1.1.8 started; log sequence number 0
140513 11:59:36 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
140513 11:59:36 [Note]   - '0.0.0.0' resolves to '0.0.0.0';
140513 11:59:36 [Note] Server socket created on IP: '0.0.0.0'.
140513 11:59:36 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist
140513 11:59:36 mysqld_safe mysqld from pid file /data/mysql/var/localhost.localdomain.pid ended

  三、根據日誌提示,多是mysql.plugin數據表不存在,拷貝原數據庫目錄/usr/local/mysql/var/*到/data/mysql/var/,重啓mysql服務/etc/init.d/mysql start,發現問題仍然存在;

  四、返回數據庫目錄查看數據權限發現全是root.root,從新設置數據權限:chown mysql.mysql /data/mysql/,重啓mysql服務/etc/init.d/mysql start,問題解決。

4、總結

 在配置Linux環境出現錯誤再所不免,MySQL故障的錯誤日誌不是很清晰,須要經驗和對錯誤日誌分析把控。那啥,數據必定要做好平常備份,發生數據災難時也有能夠恢復的源。

相關文章
相關標籤/搜索