- August, 2005
-
Moving the MySQL's datadir directory.
By default, MySQL's
datadiris placed in the/var/lib/mysqldirectory. However, if you are planning on using MySQL tables to store a lot of data and your/varpartition is small, it might cause you problem at a later stage. In such a scenario, it is better to move the MySQL'sdatadirto another partition (like/home.The steps are
- Stop your mysql server before starting this operation
- Create the directories that will be new
datadir chownthe directory to themysql:mysqluser- copy the files from the old
datadirto the new location. However, make sure that the files namedib_arch_log_0000000000, ib_logfile0etc. are not copied to the newer location. - Make sure that the files and directories are owned by
mysqluser - Make changes in the my.cnf to point the new
datadir. - Restart the MySQL database
- You might need to do varying degree of troubleshooting to get the server working if there is some problem
- Create a new database and verify that the files for this database
are getting created in the new
datadir - After the server is running for a few days properly, get rid of the old data.
- Sleep
Defined tags for this entry: geek stuff
Page 1 of 1, totaling 1 entries
