docker search mysql 搜索mysql镜像
docker pull mysql 拉取镜像
docker run -p 3306:3306 --name mysql -v $PWD/conf:/etc/mysql/conf.d -v $PWD/logs:/logs -v $PWD/data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=123456 -d mysql 创建容器
docker exec -it mysql /bin/bash 进入mysql容器
mysql -uroot -p 进入mysql
GRANT ALL ON *.* TO 'root'@'%'; 授权
flush privileges; 刷新权限
ALTER USER'root'@'localhost' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER; 更新加密规则
ALTER USER'root'@'%' IDENTIFIED WITH mysql_native_password BY '123456'; 更新root用户密码
flush privileges; 刷新权限
配置nginx解析php
server {
listen 80;
server_name 127.0.0.1;#access_log /var/log/nginx/host.access.log main;# nginx容器内对应的路径
root /usr/share/nginx/html;
location / {
index index.html index.htm index.php;}#error_page 404 /404.html;# redirect server error pages to the static page /50x.html#
error_page 500502503504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;}# proxy the PHP scripts to Apache listening on 127.0.0.1:80##location ~ \.php$ {# proxy_pass http://127.0.0.1;#}# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000#
location ~ \.php$ {# php容器里面对应的文件
root /var/www/html/;# 用来指定php-fpm监听的地址
fastcgi_pass 127.0.0.1:9000;# 设定访问根目录默认去找的文件
fastcgi_index index.php;# 设置访问根目录时默认寻找的文件
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;}# deny access to .htaccess files, if Apache's document root# concurs with nginx's one##location ~ /\.ht {# deny all;#}}