LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to change the location of mysql (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-change-the-location-of-mysql-522456/)

lexthoonen 01-24-2007 02:14 PM

how to change the location of mysql
 
for my dedicated web server that i rent, i think mysql was by default set up in /var in stead of /home.

that might as well be normal, i have no clue

Now, my 4.8 GB /var has only 836 MB free, and my 99.9 GB /home has 91.3 GB free.

What should I do? Change the mysql to /home or add space to /var ?

And... how?

(I'm new with linux so all help is appreciated)

Thanks!

Guttorm 01-25-2007 04:12 AM

Hi

MySql has a config file. On my system its at /etc/mysql/my.cnf. In there is a line like:
datadir=/var/lib/mysql
You dont say what distro you have, so it might be different on your computer.

You can copy or move all in this directory to a different place, and then update the my.cnf file.

NB:
MySql has to be stopped when you do this!
If you copy, use the -p option to keep permissions, e.g.
cp -r -p /var/lib/mysql /home/mysql

lexthoonen 01-25-2007 11:45 AM

mysql location
 
Thanks!

This sounds very healthy, I'll do it and will let you know how it went. Thanks again.

prasanta 01-25-2007 11:55 AM

Quote:

You can copy or move all in this directory to a different place, and then update the my.cnf file.
Copying all the files does work, but from my experience it is better to take a mysql dump of the database. I also had the same problem. I rsync-ed the whole directory to another place, change the path in my.cnf but still it gave errors. I had to reindex after which everything worked fine.

--
Prasanta

lexthoonen 01-25-2007 12:02 PM

db dump
 
Okay, I'll keep that in mind, thanks. (I even know how to do that i think :) )


All times are GMT -5. The time now is 01:10 PM.