GIT – MySQL is a widely used and fast SQL database server.How to change datadir mysql, backup database mysql, optimize mysql. It is a client/server implementation that consists of a server daemon (mysqld) and many different client programs/libraries.
What is Mysql Data Directory?
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.
Note: This is only for advanced users and before moving default directory make a backup of your mysal databases.
Step 1. Backup your database!
Step 2. Shutdown mysql
service mysqld stop
Step 3. Create a new data directory on /mnt and change
Step 4. Change ownership of that directory to the same owner of your rails app
chown mysql:mysql -R /data/mysql
Step 5. Modify the mysql config file
Which will look like this:
Noticed I changed the very first line to point to /data/mysql.
Step 6. Move your databases to /data/mysql
# mv /var/lib/mysql/ /data/mysql
Step 7. Restart mysql
service mysqld start
Thảo luận bài viết tại forum : http://forum.gocit.vn/threads/change-datadir-mysql.454/