我的 Mysql 数据位于 aws 中的 EBS 卷中,我需要将 Mysql 指向该目录而不是/var/lib/mysql
。我遵循的这些步骤不会改变datadir
sudo systemctl stop mysql
更改 mysql datadir 指向/vol
此处的新卷。
sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf
然后编辑 apparmour 并添加这些路径
/vol/mysql/ r, /vol/mysql/** rwk,
sudo systemctl reload apparmor
sudo systemctl start mysql
这给了我错误,就像这样
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Fri 2019-11-22 09:36:17 UTC; 15min ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Process: 6439 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE)
Process: 6387 ExecStartPre=/usr/share/mysql-8.0/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Main PID: 6439 (code=exited, status=1/FAILURE)
Status: "Data Dictionary upgrade from MySQL 5.7 in progress"
Error: 13 (Permission denied)
Nov 22 09:36:16 ip-10-0-0-11 systemd[1]: Starting MySQL Community Server...
Nov 22 09:36:17 ip-10-0-0-11 systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
Nov 22 09:36:17 ip-10-0-0-11 systemd[1]: mysql.service: Failed with result 'exit-code'.
Nov 22 09:36:17 ip-10-0-0-11 systemd[1]: Failed to start MySQL Community Server.
有人知道这件事吗?
这些是我的错误日志
2019-11-22T09:36:17.139279Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.18) starting as process 6439
2019-11-22T09:36:17.147741Z 1 [System] [MY-011012] [Server] Starting upgrade of data directory.
2019-11-22T09:36:17.153493Z 1 [ERROR] [MY-012209] [InnoDB] Multiple files found for the same tablespace ID:
2019-11-22T09:36:17.153561Z 1 [ERROR] [MY-012202] [InnoDB] Tablespace ID: 1 = ['mysql/innodb_table_stats.ibd', 'mysql/sys/sys_config.ibd']
2019-11-22T09:36:17.153631Z 1 [ERROR] [MY-012930] [InnoDB] Plugin initialization aborted with error Failed, retry may succeed.
2019-11-22T09:36:17.153699Z 1 [ERROR] [MY-011013] [Server] Failed to initialize DD Storage Engine.
2019-11-22T09:36:17.153874Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2019-11-22T09:36:17.154325Z 0 [ERROR] [MY-010119] [Server] Aborting
2019-11-22T09:36:17.154678Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.18) MySQL Community Server - GPL.