I wanted to change the location of the datadir for mysql. I had some troubles accomplishing this and the solutions I saw online were not fully accurate, so for the record, here is how I achieved this.
I installed Kubuntu 9.10 in my new computer, and wanted to move my old database data from my old computer. Also, I wanted to change the datadir to /home/mysql/ instead of the default /var/lib/mysql/.
Stop the mysqld server:
/etc/init.d/mysql stop
edit my.cnf:
vi /etc/mysql/my.cnf
// set:
// dir = /home/mysql
I don't know what apparmor is for, but there was a note in the above my.cnf file to update it as well, so I also replaced /var/lib/mysql/ with /home/mysql/ there:
vi /etc/apparmor.d/usr.sbin.mysqld
// set:
// /home/mysql/ r,
// /home/mysql/** rwk,
Restart apparmor, which is a crucial step that I missed earlier:
/etc/init.d/apparmor restart
restart mysql:
/etc/init.d/mysql start
Final step:
rejoice
Post new comment