鍍金池/ 問答/Linux  數(shù)據(jù)庫/ CentOS7啟動MYSQL報錯

CentOS7啟動MYSQL報錯

[root@localhost init.d]# service mysql start
Redirecting to /bin/systemctl start mysql.service
Job for mysqld.service failed because a timeout was exceeded. See "systemctl status mysqld.service" and "journalctl -xe" for details.

在日志中發(fā)現(xiàn)錯誤:
2017-12-08 14:37:52 32407 [ERROR] InnoDB: ./ibdata1 can't be opened in read-write mode
2017-12-08 14:37:52 32407 [ERROR] InnoDB: The system tablespace must be writable!
2017-12-08 14:37:52 32407 [ERROR] Plugin 'InnoDB' init function returned error.
2017-12-08 14:37:52 32407 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2017-12-08 14:37:52 32407 [ERROR] Unknown/unsupported storage engine: InnoDB
2017-12-08 14:37:52 32407 [ERROR] Aborting

2017-12-08 14:37:52 32407 [Note] Binlog end

網(wǎng)上找到的解決方法刪除DATA文件夾下的兩個文件重啟mysql并不管用

回答
編輯回答
蔚藍(lán)色
  1. 首先確認(rèn)datadir位置,ibdata1默認(rèn)寫在datadir目錄下
  2. 刪除datadir,然后重新初始化mysql

/usr/sbin/mysqld --initialize-insecure --user=mysql --datadir=/data/mysql --sock=/var/lib/mysql/mysql.sock

2018年7月24日 11:49