標籤:斷行符號 mmu The 列印 參數 amp pretty 導致 IV
[[email protected] ~]# systemctl start mysqld 啟動失敗
Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details.
查看系統日誌報錯為:
May 29 19:04:53 localhost mysqld: 2018-05-29T11:04:53.723812Z 0 [ERROR] InnoDB: The innodb_system data file ‘ibdata1‘ must be writable
May 29 19:04:53 localhost mysqld: 2018-05-29T11:04:53.723862Z 0 [ERROR] InnoDB: The innodb_system data file ‘ibdata1‘ must be writable
May 29 19:04:53 localhost mysqld: 2018-05-29T11:04:53.723871Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
May 29 19:04:54 localhost mysqld: 2018-05-29T11:04:54.325440Z 0 [ERROR] Plugin ‘InnoDB‘ init function returned error.
May 29 19:04:54 localhost mysqld: 2018-05-29T11:04:54.325475Z 0 [ERROR] Plugin ‘InnoDB‘ registration as a STORAGE ENGINE failed.
May 29 19:04:54 localhost mysqld: 2018-05-29T11:04:54.325483Z 0 [ERROR] Failed to initialize builtin plugins.
May 29 19:04:54 localhost mysqld: 2018-05-29T11:04:54.325485Z 0 [ERROR] Aborting
報錯原因大致為:你的資料檔案不可寫
導致原因:yum安裝的mysql的擁有者是root,而mysql要求執行身份為mysql,許可權問題導致資料檔案不可寫
解決方案如下:
[[email protected] ~]# chown -R mysql /var/lib/mysql
[[email protected] ~]# systemctl start mysqld
[[email protected] ~]# tailf /var/log/messages &
日誌列印:
May 29 19:09:15 localhost mysqld: Version: ‘5.7.22‘ socket: ‘/var/lib/mysql/mysql.sock‘ port: 3306 MySQL Community Server (GPL)
啟動成功
登入 MySQL,此時不要求輸入密碼,直接斷行符號:
# mysql -u root -p
更改 root 密碼 為 123456:
mysql> use mysql;mysql> update user set authentication_string=password("123456") where user=‘root‘;mysql> flush privileges; # 重新整理許可權,不重新整理的話可能導致mysql斷行符號直接就會登入
注意密碼欄位名 5.7 版本的是 authentication_string,之前的為 password。
修改完後,記得注釋掉 my.cnf 中的 skip-grant-tables 參數,重啟 MySQL 服務,就可以用你設定的密碼登入了。
centos7 yum安裝mysql後啟動不起來問題