I install mysql8.0, its fine.
but i want change Data Directory to a New Location.
It's follow this link
https://www.digitalocean.com/community/tutorials/how-to-move-a-mysql-data-directory-to-a-new-location-on-ubuntu-20-04
and follow step4,I can't restart Mysql
Now it’s time to start MySQL. If you do, however, you’ll run into another error. Instead of an AppArmor issue, this error is caused by mysql-systemd-start, a script that supports managing MySQL through systemd. You can inspect this script with the following command:
nano /usr/share/mysql/mysql-systemd-start
and it's out
verify_ready $1
verify_database $1
/lib/apparmor/profile-load usr.sbin.mysqld
if [ ! -r /etc/mysql/my.cnf ]; then
echo "MySQL configuration not found at /etc/mysql/my.cnf. Please install one."
exit 1
fi
So, how can fix this problem? and i don't want reinstall mysql, because i want change Data Directory to a New Location.
Thanks all
Best Answer
Answer by leoce
01 modify /etc/apparmor.d/usr.sbin.mysqld, change /var/lib/mysql to the custom path, then reload apparmor 02 disable apparmor for mysql
apparmor_parser -R /etc/apparmor.d/disable/usr.sbin.mysqld 03 disable apparmor completely