wordpress迁移docker

未分类

wget -qO- https://get.docker.com/ | sh
sudo service docker start

docker ps -a

docker pull mysql:5.5
docker pull wordpress

docker images

docker run –name new_mysql -v /home/new/mysql:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=你的密码 -d mysql:5.5
docker run –name new_wordpress -v /home/new/wordpress:/var/www/html/ –link helianinfo_mysql:mysql -p 80:80 -d wordpress

mysqldump -u root -p wordpress > wordpress_backup.sql

docker exec -it new_mysql bash
mysql> set global max_allowed_packet=1024*1024*54;
mysql -u root -p wordpress < wordpress_backup.sql

UPDATE wp_options SET option_value = replace(option_value, ‘旧域名‘,’新域名‘);

UPDATE wp_posts SET guid = replace(guid, ‘http://helian.info/’, ‘http://新域名/’);
UPDATE wp_options SET option_value = replace(option_value, ‘http://旧域名/’, ‘http://新域名/’);
UPDATE wp_postmeta SET meta_value = replace(meta_value, ‘http://旧域名/’, ‘http://新域名/’);