Connect remote mysql8 with docker

Run mysql8 with docker and get remote connection.

Start a container with mysql8:

1
2
3
4
5
6
7
8
9
docker run -d \
--name mysql8 \
-v /srv/mysql/data:/var/lib/mysql \
-v /srv/mysql/conf.d:/etc/mysql/conf.d \
-p 3333:3306 \
-e MYSQL_ROOT_PASSWORD=password \
--character-set-server=utf8mb4 \
--collation-server=utf8mb4_unicode_ci \
mysql:8

Change default authentication:

1
2
3
mysql> use mysql;
mysql> alter user 'root'@'%' identified with mysql_native_password by 'password';
mysql> flush privileges;

Now you can connect remote mysql8.

hsowan wechat
欢迎您扫一扫上面的微信公众号,订阅我的博客!