pull image
docker pull mysql/mysql-server:8.0
run mysql server
docker run --name=mysql-demo \
-v ~/mysql/conf.d:/etc/mysql/conf.d \
-v ~/mysql/mysql-data:/var/lib/mysql \
-e MYSQL_ROOT_PASSWORD=123456 \
-p 3306:3306 -d mysql/mysql-server:8.0
add remote user access
docker exec -it mysql-demo mysql -uroot -p
CREATE USER 'myuser'@'%' IDENTIFIED BY 'mypass';
GRANT ALL ON *.* TO 'myuser'@'%';
FLUSH PRIVILEGES;
change config
vi ~/mysql/conf.d/myconfig
bind-address = 0.0.0.0
restart mysql
docker restart mysql-demo