A-A+

lnmp整体搬家ssh操作方法

2012年07月23日 主机域名 lnmp整体搬家ssh操作方法已关闭评论 阅读 704 人 次

备份

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

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

标签:

评论已关闭!