mysql☞安装.

阅读量: zyh 2019-02-10 15:53:04
Categories: > Tags:

https://hub.docker.com/_/mysql?tab=description

mkdir -p /export/docker-data-mysql/{config,logs,mysql,mysql-files}
docker run --name mysql8 \
-p 3306:3306 \
--restart=always \
--mount 'type=bind,src=/export/docker-data-mysql/config,dst=/etc/mysql' \
--mount 'type=bind,src=/export/docker-data-mysql/logs,dst=/var/log/mysql' \
--mount 'type=bind,src=/export/docker-data-mysql/mysql,dst=/var/lib/mysql' \
--mount 'type=bind,src=/export/docker-data-mysql/mysql-files,dst=/var/lib/mysql-files' \
-e MYSQL_ROOT_PASSWORD=123456 \
-d mysql:8 \
--character-set-server=utf8mb4 \
--collation-server=utf8mb4_general_ci

mysql8 开启远程访问

alter user 'root'@'指定IP' identified with mysql_native_password by '123456';

mysql5.7 开启远程访问

GRANT ALL PRIVILEGES ON *.* TO 'root'@'指定IP' IDENTIFIED BY '123456' WITH GRANT OPTION;