使用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

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