Skip navigation.

mysql

MySQL: changing data dir

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

Syndicate content