{"id":1082,"date":"2013-04-19T19:24:27","date_gmt":"2013-04-19T19:24:27","guid":{"rendered":"http:\/\/invisiblezero.net\/?p=621"},"modified":"2013-04-19T19:24:27","modified_gmt":"2013-04-19T19:24:27","slug":"mysql-change-data-directory-base","status":"publish","type":"post","link":"http:\/\/ndthanh.com\/mysql-change-data-directory-base\/","title":{"rendered":"MySQL – Change data directory (base)"},"content":{"rendered":"
<\/p>\n
MySQL is a widely used and fast SQL database server. It is a client\/server implementation that consists of a server daemon (mysqld) and many different client programs\/libraries.<\/p>\n
Mysql data directory is important part where all the mysql databases storage location.By default MySQL data default directory located in \/var\/lib\/mysql.If you are running out of space in \/var partition you need to move this to some other location.<\/p>\n
Note:- This is only for advanced users and before moving default directory make a backup of your mysal databases.<\/p>\n
<\/p>\n
First you should stop the mysql server. e.g.<\/p>\n
\n # \/etc\/init.d\/mysql stop\n\n<\/pre>\nAfter that you should copy the old data directory (e.g. \/var\/lib\/mysql) incl. privileges to your new directory via<\/p>\n
\n # cp -R -p \/var\/lib\/mysql \/new\/data\/dir\n\n<\/pre>\nnow you can change in \/etc\/mysql\/my.cnf the data new and restart the server<\/p>\n
\n # \/etc\/init.d\/mysql restart\n\n<\/pre>\nYou have to copy the database when the server is not running.<\/p>\n","protected":false},"excerpt":{"rendered":"
MySQL is a widely used and fast SQL database server. It is a client\/server implementation that consists of a server daemon (mysqld) and many different client programs\/libraries. Mysql data directory is important part where all the mysql databases storage location.By default MySQL data default directory located in \/var\/lib\/mysql.If you are running out of space in…<\/p>\n