Jun 25th, 2009
Steps to change the mysql database directory in Linux server
Steps to change the mysql database directory in Linux server
Some times the ‘/var’ partition get crowded and we might need to relocate the database to some other location where there is enough space. Below are the steps given for a trouble free relocation.
Note: Let ‘/mysql’ be the directory to which we want to relocate the database.
Steps to change the mysql database directory:
1. Execute the following command in the server to write the transactions saved in the memory to the hard disk.
2. Stop the mysql process in the server.
3. Move the database files to the the new directory.
4. Create symlink with the old directory.
5. Give the correct ownership to the new directory.
6. Restart mysql in the server.