I have my Mysql data in a EBS volume in aws, I need to point my Mysql to point to that directory instead of /var/lib/mysql
. These steps i followed by this doesnot change the datadir
sudo systemctl stop mysql
Changed mysql datadir pointing to new volume which is in /vol
in this..
sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf
Then edited apparmour and added these path
/vol/mysql/ r,
/vol/mysql/** rwk,
sudo systemctl reload apparmor
sudo systemctl start mysql
This gives me error, like this
● 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.
Does someone know about this?
These are my error.log
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.