lnmp整体搬家ssh操作方法

2,199 人次阅读
没有评论

共计 825 个字符,预计需要花费 3 分钟才能阅读完成。

备份

killall nginx
service mysql stop
tar zcvf /home/wwwroot/wwwroot.tar.gz /home/wwwroot
tar zcvf /home/wwwroot/nginx.tar.gz /usr/local/nginx/conf
tar zcvf /home/wwwroot/mysql.tar.gz /usr/local/mysql/var
tar zcvf /home/wwwroot/php.tar.gz /usr/local/php/etc
/usr/local/nginx/sbin/nginx
service mysql start

还原

killall nginx
service mysql stop
tar zxvf wwwroot.tar.gz
tar zxvf nginx.tar.gz
tar zxvf mysql.tar.gz
tar zxvf php.tar.gz
mv /usr/local/nginx/conf /usr/local/nginx/conf-bak
mv /usr/local/mysql/var /usr/local/mysql/var-bak
mv usr/local/php/etc usr/local/php/etc-bak
mv home/wwwroot /home/wwwroot
mv usr/local/nginx/conf /usr/local/nginx/conf
mv usr/local/mysql/var /usr/local/mysql/var
mv usr/local/php/etc /usr/local/php/etc
chown -R mysql /usr/local/mysql/var
chown -R www /usr/local/nginx/conf
/usr/local/nginx/sbin/nginx
service mysql start

备份好 重装后 创建同名的数据库 然后把备份好的数据库文件放到创建好的文件夹里即可
我是这么做的 还没发现什么错误

正文完
 0