mysql 迁移数据文件之后报 [ERROR] InnoDB: The innodb_system data file 'ibdata1' must be writable

场景:我把备份的数据目录还原回来启动数据库报错,查看错误日志信息如下:

2018-04-04  1:34:27 140362091378496 [ERROR] mysqld: File '/data/mysql/data/aria_log_control' not found (Errcode: 13 "Permission denied")
2018-04-04  1:34:27 140362091378496 [ERROR] mysqld: Got error 'Can't open file' when trying to use aria control file '/data/mysql/data/aria_log_control'
2018-04-04  1:34:27 140362091378496 [ERROR] Plugin 'Aria' init function returned error.
2018-04-04  1:34:27 140362091378496 [ERROR] Plugin 'Aria' registration as a STORAGE ENGINE failed.
2018-04-04  1:34:27 140362091378496 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-04-04  1:34:27 140362091378496 [Note] InnoDB: Uses event mutexes
2018-04-04  1:34:27 140362091378496 [Note] InnoDB: Compressed tables use zlib 1.2.3
2018-04-04  1:34:27 140362091378496 [Note] InnoDB: Using Linux native AIO
2018-04-04  1:34:27 140362091378496 [Note] InnoDB: Number of pools: 1
2018-04-04  1:34:27 140362091378496 [Note] InnoDB: Using SSE2 crc32 instructions
2018-04-04  1:34:27 140362091378496 [Note] InnoDB: Initializing buffer pool, total size = 2G, instances = 8, chunk size = 128M
2018-04-04  1:34:27 140362091378496 [Note] InnoDB: Completed initialization of buffer pool
2018-04-04  1:34:27 140359394723584 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2018-04-04  1:34:27 140362091378496 [ERROR] InnoDB: The innodb_system data file 'ibdata1' must be writable
2018-04-04  1:34:27 140362091378496 [ERROR] InnoDB: The innodb_system data file 'ibdata1' must be writable
2018-04-04  1:34:27 140362091378496 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2018-04-04  1:34:27 140362091378496 [Note] InnoDB: Starting shutdown...
2018-04-04  1:34:27 140362091378496 [ERROR] Plugin 'InnoDB' init function returned error.
2018-04-04  1:34:27 140362091378496 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2018-04-04  1:34:27 140362091378496 [Note] Plugin 'FEEDBACK' is disabled.
2018-04-04  1:34:27 140362091378496 [ERROR] Could not open mysql.plugin table. Some plugins may be not loaded
2018-04-04  1:34:27 140362091378496 [ERROR] Unknown/unsupported storage engine: InnoDB
2018-04-04  1:34:27 140362091378496 [ERROR] Aborting

查看数据目录权限

 

[[email protected] data]# ll
total 1847340
-rw-r-----  1 root root      16384 Apr  3 14:37 aria_log.00000001
-rw-r-----  1 root root         52 Apr  3 14:37 aria_log_control
-rw-r-----  1 root root       5753 Apr  3 14:37 ib_buffer_pool
-rw-r-----  1 root root 1073741824 Apr  3 14:37 ibdata1
-rw-r-----  1 root root  134217728 Apr  3 14:37 ib_logfile0
-rw-r-----  1 root root  134217728 Apr  3 14:37 ib_logfile0.bak
-rw-r-----  1 root root  134217728 Apr  3 14:37 ib_logfile1
-rw-r-----  1 root root  134217728 Apr  3 14:37 ib_logfile1.bak
-rw-r-----  1 root root  134217728 Apr  3 14:37 ib_logfile2
-rw-r-----  1 root root  134217728 Apr  3 14:37 ib_logfile2.bak
-rw-r-----  1 root root   12582912 Apr  3 14:37 ibtmp1
-rw-r-----  1 root root          0 Apr  3 14:37 multi-master.info
drwx------  2 root root       4096 Apr  3 14:37 mysql
-rw-r-----  1 root root          6 Apr  3 14:37 mysql.pid
drwx------  2 root root         20 Apr  3 14:37 performance_schema
drwx------  2 root root       4096 Apr  3 14:37 sakila
drwx------ 10 root root       4096 Apr  3 14:37 test

文件的操作权限不够,可以修改下该文件的读写权限或目录下所有文件的权限。

[[email protected] data]# chown -R mysql.mysql *

数据库启动成功

[[email protected] data]# service mysql start
Starting mysql (via systemctl):                            [  OK  ]
[[email protected] data]# ps -ef|grep mysql
root     16763 16518  0 Apr03 pts/3    00:00:00 mysql -uroot -px xx
root     26307     1  0 01:37 ?        00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/data/mysql/data --pid-file=/data/mysql/data/mysql.pid
mysql    26659 26307  0 01:37 ?        00:00:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/data/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/data/mysql/log/error.log --open-files-limit=65535 --pid-file=/data/mysql/data/mysql.pid --socket=/tmp/mysql.sock --port=3306
root     26813 15829  0 01:49 pts/1    00:00:00 grep --color=auto mysql

你可能感兴趣的:(Mysql,故障处理)