Wednesday, May 28, 2008

Installing and setting up a fink installed MySQL with a non-default data directory

So I assume you have successfully executed: sudo fink install mysql

Create or edit /etc/my.cnf and add or change the keyword datadir to the directory you want e.g.

[mysqld]
datadir=/Volumes/another/directory
[mysqld_safe]
datadir=/Volumes/another/directory

During installation, Fink set up some files and directories in /sw/var/mysql.  Copy the contents of this directory to your new directory e.g.

sudo cp -r /sw/var/mysql/* /Volumes/another/directory

Go to /Volumes/another/directory and set the owner of all contents to mysql e.g.
sudo chown -R mysql /Volumes/another/directory.

At this point you should be able to run 'sudo mysqld_safe.'

No comments: