GIT – is a widely used and fast SQL database server.How to change datadir , backup database , optimize . 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

mkdir /data/mysql

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

whereis my.cnf

=> /etc/my.cnf

vi /etc/my.cnf

Which will look like this:

——————-

[mysqld]
datadir=/data/mysql

#/var/lib/mysql/
socket=/var/lib/mysql/mysql.sock

[mysqld_safe]

log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

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/

Bài viết này nằm trong dự án  website : www.gocit.vn, forum hổ trợ forum.gocit.vn , xem thêm tại link http://www.gocit.vn/du-an-linux-toan-tap/
Print Friendly

Comments

comments

Bài viết liên quan