docker容器内怎么连接外部的mysql?

docker容器内怎么连接外部的mysql


倚天杖
浏览 6885回答 1
1回答

暮色呼如

1 docker pull mysql2 docker run -v /data/var/mysql/:/var/lib/mysql -e YSQL_ROOT_PASSWORD=kS4pJUIb mysql3 docker stop [CONTAINER ID]4 docker run -it -v /data/var/mysql/:/var/lib/mysql mysql /bin/bash5 mysqld_safe&6 grant all privileges on *.* to 'wuxiao'@'%' identified by 'password';7 docker cp [CONTAINER ID]:/etc/mysql/my.cnf /data/local/my.cnf8 docker stop [CONTAINER ID]9 docker run -d -p 3306:3306 -v /data/var/mysql/:/var/lib/mysql -v /data/local/my.cnf:/etc/mysql/my.cnf mysql10 add [CMD] to /etc/rc.local11 OK!
打开App,查看更多内容
随时随地看视频慕课网APP