使用xtrabackup進行對數據進行全量恢復後,啓動數據庫報錯

使用xtrabackup對數據庫進行了全量恢復後,手動啓動數據庫報錯。
[root@slyl-dev-db ~]# service mysqld start
Redirecting to /bin/systemctl start mysqld.service
Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details.

查看現有系統未啓動mysql進程
[root@slyl-dev-db ~]# ps -ef | grep mysql
root 26673 25056 0 22:12 pts/0 00:00:00 grep --color=auto mysql

在mysql/logs目錄下打開error.log文件,查看報錯詳情:
2020-03-18T11:14:13.333632Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2020-03-18T11:14:13.391230Z 0 [ERROR] InnoDB: /data/mysql/mysql_3306/logs/ib_logfile0 can't be opened in read-write mode.
2020-03-18T11:14:13.391284Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2020-03-18T11:14:13.991989Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2020-03-18T11:14:13.992018Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2020-03-18T11:14:13.992028Z 0 [ERROR] Failed to initialize builtin plugins.
2020-03-18T11:14:13.992035Z 0 [ERROR] Aborting

2020-03-18T11:14:13.992049Z 0 [Note] Binlog end
2020-03-18T11:14:13.992722Z 0 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete

第一條個錯誤就是對ib_logfile文件沒有讀寫權限。

查看ib_logfile權限爲root
[root@slyl-dev-db logs]# ll
總用量 3145744
-rw-r----- 1 mysql mysql 12700 3月 18 22:19 error.log
-rw-r----- 1 root root 1073741824 3月 18 19:04 ib_logfile0
-rw-r----- 1 root root 1073741824 3月 18 19:04 ib_logfile1
-rw-r----- 1 root root 1073741824 3月 18 19:05 ib_logfile2

解決辦法:

刪除ib_logfile文件後,再次啓動mysql即可。

[root@slyl-dev-db mysql_3306]# systemctl start mysqld
[root@slyl-dev-db mysql_3306]# ps -ef | grep mysql
mysql 30568 1 0 22:25 ? 00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/data/mysql/mysql_3306/data --pid-file=/data/mysql/mysql_3306/tmp/mysql.pid
mysql 32007 30568 15 22:25 ? 00:00:05 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/data/mysql/mysql_3306/data --plugin-dir=/usr/local/mysql/lib/plugin --log-error=/data/mysql/mysql_3306/logs/error.log --open-files-limit=65535 --pid-file=/data/mysql/mysql_3306/tmp/mysql.pid --socket=/data/mysql/mysql_3306/tmp/mysql.sock --port=3306
root 32142 25056 0 22:26 pts/0 00:00:00 grep --color=auto mysql

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章