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

博主在将备份的数据目录还原后启动数据库报错,查看错误日志后,发现是文件操作权限不够,通过修改文件或目录下所有文件的读写权限,最终数据库启动成功。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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

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
D:\Mysql\bin>mysqld --skip-grant-tables --console 2025-03-16T05:33:30.362796Z 0 [System] [MY-015015] [Server] MySQL Server - start. 2025-03-16T05:33:30.535298Z 0 [Warning] [MY-010915] [Server] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release. 2025-03-16T05:33:30.535705Z 0 [System] [MY-010116] [Server] D:\Mysql\bin\mysqld.exe (mysqld 9.2.0) starting as process 28996 2025-03-16T05:33:30.538219Z 0 [Warning] [MY-013242] [Server] --character-set-server: 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous. 2025-03-16T05:33:30.560258Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started. 2025-03-16T05:33:30.561797Z 1 [ERROR] [MY-012271] [InnoDB] The innodb_system data file 'ibdata1' must be writable 2025-03-16T05:33:30.561919Z 1 [ERROR] [MY-012278] [InnoDB] The innodb_system data file 'ibdata1' must be writable 2025-03-16T05:33:30.562082Z 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine 2025-03-16T05:33:30.562492Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed. 2025-03-16T05:33:30.562634Z 0 [ERROR] [MY-010119] [Server] Aborting 2025-03-16T05:33:30.563777Z 0 [System] [MY-010910] [Server] D:\Mysql\bin\mysqld.exe: Shutdown complete (mysqld 9.2.0) MySQL Community Server - GPL. 2025-03-16T05:33:30.563939Z 0 [System] [MY-015016] [Server] MySQL Server - end.
最新发布
03-17
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值