RPM installation of MySQL, the path installed by default is
/var/lib/mysql/
#数据库目录,修改此目录到数据盘,就ok
/usr/share/mysql #配置文件目录
/usr/bin #相关命令目录
/etc/init.d/mysql #启动脚本
查看云服务器,磁盘占用情况:
[[email protected] mysql]# df -l
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/vda1 20641404 1828532 17764356 10% / 系统盘
/dev/vdb1 206424432 381936 195556756 1% /mydata 数据盘
Change the MySQL data storage directory
1. Shut down the MySQL server:
/etc/init.d/mysql stop
2. The following new directory takes/mydata/mysql/as an example, and then copies the old directory's database to the new directory:
Cp-r/var/lib/mysql/*/mydata/mysql/
3. Assign the new directory to the MySQL user group:
Chown Mysql:mysql-r/mydata/mysql/
4. Modify the configuration file again:
Vi/etc/my.cnf
Find MySQL Data original directory/var/lib/mysql modified to:
DataDir =/mydata/mysql
Innodb_data_home_dir =/mydata/mysql
Innodb_log_group_home_dir =/mydata/mysql
5. Start MySQL:
/etc/init.d/mysql start reprint from http://blog.csdn.net/lzq123_1/article/details/51489842
MySQL Data migration