|
Moving MySQL Data Files in Ubuntu |
|
Saturday, 26 July 2008 00:00 |
|
When we originally installed MySQL, we used all the default locations.
After a while, we realized that the default location of the data files
were not on our largest partition, so we wanted to relocate where the
files were kept. Making this move was relatively easy, once we figured
out the right steps.
First, stop the MySQL server: sudo /etc/init.d/mysql stop
Then, move your files (your locations may vary):
sudo mv /var/lib/mysql /path/to/newmysql
Next, update the MySQL configuration file to point to the new location:
sudo nano /etc/mysql/my.cnf Look for the line that says "datadir" and update it to the new path. Lastly, start the MySQL server again:
sudo /etc/init.d/mysql start
That should be it! Quickly verify that everything is running properly, and you should be on your way.
|