現象
Mysqlサーバーの起動が失敗する
Initializing MySQL database: [FAILED]
環境
OS | CentOS 6.10 |
mysqld | 8.0.15 |
起動時ログ
2019-03-26T09:25:15.441654Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.15) initializing of server in progress as process 5594
2019-03-26T09:25:15.461498Z 0 [ERROR] [MY-010457] [Server] --initialize specified but the data directory has files in it. Aborting.
2019-03-26T09:25:15.461536Z 0 [ERROR] [MY-013236] [Server] Newly created data directory /var/lib/mysql/ is unusable. You can safely remove it.
2019-03-26T09:25:15.462090Z 0 [ERROR] [MY-010119] [Server] Aborting
2019-03-26T09:25:15.469075Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.15) MySQL Community Server - GPL.
解決策
ディレクトリを削除
$ sudo ls -al /var/lib/mysql/
total 8
drwxr-x--x 2 mysql mysql 4096 Jan 25 23:51 .
drwxr-xr-x. 23 root root 4096 Mar 26 09:24 ..
-rw-r----- 1 mysql mysql 0 Mar 26 09:15 mysql-bin.index
$ /var/lib/mysql/
$ sudo service mysqld start
Initializing MySQL database: [ OK ]
Starting mysqld: [ OK ]