centos 7: 迁移MySQL目录

Steps:

1. systemctl stop mariadb

2. mkdir data destination folder, ex: /home/mysql

3. cp -R /var/lib/mysql/* /home/mysql

4. edit /etc/my.cnf

    datadir = /home/mysql
    socket = /home/mysql/mysql.sock

5. chcon -Rt mysqld_db_t /home/mysql/

    chcon -Ru system_u /home/mysql/

    chown -R mysql:mysql /home/mysql/

 

Done.

posted @ 2016-06-21 13:25  GreatK  阅读(951)  评论(0编辑  收藏  举报