一、MysqL
- 停止MysqL服务,复制存储数据
sudo service MysqL stop
sudo cp -R -p /var/lib/MysqL /data/lib/
datadir = /data/lib/MysqL
/var/lib/MysqL/ r,/var/lib/MysqL/** rwk,/data/lib/MysqL/ r,/data/lib/MysqL/** rwk,
- 重启MysqL服务
sudo service MysqL start
二、mongo
sudo service mongod stop
sudo cp -R -p /var/lib/mongodb /data/lib
sudo vim /etc/mongod.conf
将dbPath: /var/lib/mongodb改成dbPath: /data/lib/mongodb
sudo service mongod start
原文链接:https://www.f2er.com/ubuntu/349682.html