1. 程式人生 > >fedora20 Starting MySQL. ERROR! The server quit without updating PID file /var/lib/mysql/Master.Hado

fedora20 Starting MySQL. ERROR! The server quit without updating PID file /var/lib/mysql/Master.Hado

今天嘗試在fedora20下安裝了下mysql,

檢視/var/lib/mysql/Master.Hadoop.err日誌發現報瞭如下的錯於是找到這篇文章,才得以解決。

Table 'mysql.plugin' doesn't exist。

但是很不幸的是,安裝過程中出現了錯誤,到網上查了很久解決方案,

最後才搞定,下面簡單說下安裝步驟:
1、yum -y install mysql mysql-server
      此時系統會自動幫你安裝好mysql-server,mysql-client以及其依賴的所有包,這是很方便的地方。此時mysql
     已經安裝完畢。

2、啟動mysqld。
      在終端鍵入systemctl start mysql.service(或者service mysqld start)即可啟動mysqld。但是這裡不幸的是,系統報錯了:
Redirecting to /bin/systemctl start mysqld.service
                     Job
failed. See system logs and 'systemctl status' for details.

然後我就去/var/log/mysqld.log中檢視具體的失敗原因,發現錯誤提示為:
 120505 11:16:50 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
120505 11:16:50 [Note] Plugin 'FEDERATED' is disabled.
/usr/libexec/mysqld: Table 'mysql.plugin' doesn't exist
120505 11:16:50 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.

120505 11:16:50 InnoDB: The InnoDB memory heap is disabled
120505 11:16:50 InnoDB: Mutexes and rw_locks use GCC atomic builtins
120505 11:16:50 InnoDB: Compressed tables use zlib 1.2.5
120505 11:16:50 InnoDB: Using Linux native AIO
120505 11:16:51 InnoDB: Initializing buffer pool, size = 128.0M
120505 11:16:51 InnoDB: Completed initialization of buffer pool
120505 11:16:51 InnoDB: highest supported file format is Barracuda.
120505 11:16:51  InnoDB: Waiting for the background threads to start
120505 11:16:52 InnoDB: 1.1.8 started; log sequence number 1595675
該錯誤的意思很明白,就是說安裝mysql資料庫後預設的表結構沒有初始化,所以當你啟動mysqld時,會提示
 說
Table 'mysql.plugin' doesn't exist。因此,我們需要把mysql的預設資料結構初始化下,具體解決辦法如下:
  在終端鍵入
/usr/bin/mysql_install_db --user=mysql --datadir=/var/lib/mysql(為方便起見,這裡的值就直接與/etc/my.cnf中的datadir值保持一致),如此以來,就解決了上面的問題。