docker 搭建 wordpress

1、拉取镜像
docker pull wordpress
docker pull mysql

2、运行wordpress容器
docker run -it --name wordpress-one -p 8001:80 -d wordpress

3、运行mysql容器
docker run -it --name=mysql-one -p 3307:3306 -e MYSQL_ROOT_PASSWORD=123456 -e TZ=Asia/Shanghai -d mysql --character-set-server=utf8mb4 --collation-server=utf8mb4_general_ci --lower_case_table_names=1


4、设置mysql数据库
#进入容器

docker exec -it mysql-one bash

#进入mysql数据库--123456

mysql -u root -p

#设置mysql允许访问

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;
FLUSH PRIVILEGES;

 

参考:https://blog.csdn.net/miapecloud/article/details/98203100?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522163533420216780366590152%2522%252C%2522scm%2522%253A%252220140713.130102334..%2522%257D&request_id=163533420216780366590152&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~all~sobaiduend~default-1-98203100.pc_search_result_control_group&utm_term=docker%E5%AE%89%E8%A3%85wordpress&spm=1018.2226.3001.4187

上一篇:WordPress网站使用Gzip压缩提高网站加载速度教程


下一篇:wordpress调用指定分类文章如何实现