1. 更改MySQL的存储目录

重要步骤:一定要先停止Mysql
# service mysqld stop
1、创建目标文件夹
# mkdir -p /data/mysql
# chown -R mysql.mysql /data/mysql/
2、迁移命令
# mysql_install_db --user=mysql --basedir=/usr --datadir=/data/mysql
3、为避免麻烦,删掉原文件夹/var/lib/mysql
# rm -rf /var/lib/mysql/*
4、修改/etc/my.cnf配置文件
[mysqld]
datadir=/data/mysql
5、启动mysql
# chkconfig mysqld on
# service mysqld restart
Copyright © 試毅-思伟 2019 all right reserved,powered by 試毅-思伟修订时间: 2019-07-02 13:44:29

results matching ""

    No results matching ""