Tuesday, November 3, 2009

MySQL custom data folder in Linux

This info relates to Arch Linux and configuration of MySQL to use custom data folder. I followed instructions to install MySQL on ArchWiki. It worked like a charm, everything was working perfectly, until I tried to change data folder. Now, probably important thing to say is that I setup rc.conf to automatically start mysqld daemon. Google did not help this time :( since whatever I tried did not work. Even MySQL official documentation was of no help. Setting datadir in my.cnf did not help. But finally I found solution, and it was super easy:

Edit file: /etc/conf.d/mysqld
And enter your data folder there (/data/mysql in my case):
MYSQLD_ROOT="/data/mysql"

After that it worked. I don't know if this is Arch Linux specific, but I hope this will help someone not to loose as much time I did figuring out.

1 comment: