Safely recompiling MySQL...

loopforever

Verified User
Joined
May 30, 2003
Messages
298
Location
/home/admin
Hey Guys,

Do you know if it's safe to recompile MySQL so databases are kept on a different partition? As it stands now, they are stored in /var/lib/mysql and for people with small /var paritions, this causes a very big problem.

Any help is appreciated :)!
 
I would advise against changing the path names to mysql, as there are a few things that point to the databases. The best way would be to just fool everything into thinking its there by creating a symlink to a new directory:

1) stop mysqld through DirectAdmin (so that it knows not to try and start it again)

2) find a spot where it fits (/home/mysql or something)

3) cp -R /var/lib/mysql /home/mysql

*** Make *absolutely* sure that it copied properly. ***

* You may want to just move the directory instead of delteting it.. or at least make a backup.. *** this is the point of no return ***

4) rm -rf /var/lib/mysql

5) ln -s /home/mysql /var/lib/mysql

6) start mysqld through DirectAdmin (so that it knows to monitor for mysql being down)

This is untested.. so use at your own risk. It should work for those people with a small var partition.

John
 
Hi John,

We've already symlinked the databases - I guess we'll just see how it goes. I'm just thinking of a more permanent fix than this, but I guess it'll have to do.

Now that we know this issue exists, you might want to add a check to the DA installer to see if the user's /var partition is < 1 or 2gb and give the EU a choice as to whether they keep the database on /var or move it to /home or elsewhere. You may already have clients in the same position as me who will eventually need a fix for this.

Thanks for your help :)! Speedy as usual :)!
 
If you symlink the whole directory instead of each database, then all new databases will be created in the new location and won't require any additional pain and suffering on your part ;)

I'll see about adding the check in the installer.

John
 
Back
Top