Instructions for next time I forget:
- First create the new dir:
# mkdir /data/mysql - Move the old mysql data to the new dir:
# cp /usr/lib/mysql/* /data/mysql/ - Set the right owner:
# chown mysql: /data/mysql -R - Edit mysql config file with new location of “datadir”
# vi /etc/mysql/my.cnf - Change mysql’s home dir in /etc/passwd
- If you are running apparmor you will get errors like these:
“InnoDB: Operating system error number 13 in a file operation.“
“Can’t create test file“
or mysql will take ages to load and not start at all.
Look for this file: /etc/apparmor.d/usr.sbin.mysqld and add these entires to the correct spot:/data/mysql/ r,
/data/mysql/** rwk,then restart apparmor /etc/init.d/apparmor restart