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

查看数据目录权限

 

[root@www.cndba.cn 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

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

[root@www.cndba.cn data]# chown -R mysql.mysql *

数据库启动成功

[root@www.cndba.cn data]# service mysql start
Starting mysql (via systemctl):                            [  OK  ]
[root@www.cndba.cn 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
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值