centos7 yum安裝mysql後啟動不起來問題

來源:互聯網
上載者:User

標籤:斷行符號   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後啟動不起來問題

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.