Centos7 移动mysql5.7.19 数据存储位置的操作方法
场景:随着数据量的增加,mysql所在的磁盘已占满,需要将data移动到空间较大的盘上。
方法:
1. 关闭mysql服务
service mysqld stop
2. 将data目录移动到空间较大的盘上
cp -a /usr/local/mysql/data/ /home/mysqldata/
-a :相当于 -pdr 的意思(参数pdr分别为:保留权限,复制软链接本身,递归复制);
3 . 修改配置文件my.cnf
... sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES basedir = /usr/local/mysql #datadir = /usr/local/mysql/data datadir = /home/mysqldata/data #log-error = /usr/local/mysql/data/mysql_error.log log-error = /home/mysqldata/data/mysql_error.log #pid-file = /usr/local/mysql/data/mysql.pid pid-file = /home/mysqldata/data/mysql.pid #socket =/usr/local/mysql/data/mysql.sock socket =/tmp/mysql.sock port=3701 ...
4. 启动mysql服务
service mysqld stop
总结
相关推荐
CoderToy 2020-11-16
emmm00 2020-11-17
王艺强 2020-11-17
ribavnu 2020-11-16
bianruifeng 2020-11-16
wangshuangbao 2020-11-13
苏康申 2020-11-13
vivenwan 2020-11-13
moyekongling 2020-11-13
云中舞步 2020-11-12
要啥自行车一把梭 2020-11-12
aydh 2020-11-12
kuwoyinlehe 2020-11-12
minerk 2020-11-12
vitasfly 2020-11-12
jazywoo在路上 2020-11-11
敏敏张 2020-11-11
世樹 2020-11-11