windows/macos 下docker启动mysql 时MYSQL_ROOT_PASSWORD不生效的问题
在mac下使用docker创建mysql容器,指定了password,但是登陆时发现设置的密码不生效,为空时可以登陆
docker run --name virtual-mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=mypassword -d mysql:5.7.22
大概查了下,1种是说需要修改密码,看了几种改的方式,在mysql命令行执行都报了错误,于是stackoverflow搜了一下,找到了答案,翻译过来是这样的
原文:https://stackoverflow.com/questions/56822246/docker-instance-of-mysql-is-not-setting-root-password-any-login-without-a-pas
截图相关引用:https://dev.mysql.com/doc/mysql-installation-excerpt/8.0/en/docker-mysql-getting-started.html
于是使用相同命令到linux下试了,果然在linux下执行设置密码是有用的,于是索性换到linux下部署了