拉取成功可以验证一下
到这里我们查看容器运行状态:
$ sudo docker ps
可以看到容器的简写ID,容器的源镜像,创建时间,状态,端口映射信息,容器名字等。
使用navicat远程连接,这里碰到几个问题
首先这个IP肯定不是localhost,然后以为是mysql容器的IP
结果是:172.17.0.2
但是还是连接不上
192.168.99.100
这个可以连接
结论:
原因:由于myslq8不支持动态修改密码验证方式
解决方案:
3.修改配置
然后可以进入容器的命令行模式,接着修改 /etc/mysql/my.cnf 文件即可
If /my/custom/config-file.cnf is the path and name of your custom configuration file, you can start your mysql container like this (note that only the directory path of the custom config file is used in this command):
This will start a new container some-mysql where the MySQL instance uses the combined startup settings from /etc/mysql/my.cnf and /etc/mysql/conf.d/config-file.cnf, with settings from the latter taking precedence.