当前位置:网站首页>Solve the problem of deploying mysql8 in docker with correct password but unable to log in to MySQL
Solve the problem of deploying mysql8 in docker with correct password but unable to log in to MySQL
2022-04-23 07:48:00 【Brother Bing】
1、 Create and start the container , Do not set login password
$ docker run -p 3306:3306 --name mysql8 --privileged=true --restart unless-stopped -v $PWD/conf:/etc/mysql/conf.d -v $PWD/logs:/logs -v $PWD/data:/var/lib/mysql -v /etc/localtime:/etc/localtime -e -d mysql:8.0.26
2、 Into the container
$ docker exec -it mysql bash
3、 Modify the configuration file
3.1 Get into /etc/mysql/conf.d
File directory :
$ cd /etc/mysql/conf.d
3.2 establish MySQL The configuration file :mysql.cnf
$ touch mysql.cnf
3.3 stay mysql.cnf
Fill the configuration file with the following
[mysqld]
# Skip password login
skip-grant-tables
3.4 Exit the container , restart mysql Containers
$ exit
$ docker restart mysql
4、 Set up MySQL The login password
4.1 Re enter MySQL Containers , Sign in MySQL
$ docker exec -it mysql bash
$ mysql -uroot -p # No password required , Just enter twice directly
4.2 Get into mysql
surface
$ use mysql
4.3 Set up MySQL The login password
$ ALTER user 'root'@'%' IDENTIFIED BY ' The password you are about to set ';
4.4 Refresh the permissions
$ flush privileges;
That's all , Then use it normally .
版权声明
本文为[Brother Bing]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230625584937.html
边栏推荐
猜你喜欢
随机推荐
系统与软件安全研究(一)
UnityShader基础
MySQL8.0 安装/卸载 教程【Window10版】
unity 屏幕自适应
js之DOM学习三种创建元素的方式
SampleCameraFilter
大学学习路线规划建议贴
Django uses MySQL database to solve error reporting
中间人环境mitmproxy搭建
MySQL index
Nodejs (four) character reading
Unity ugui determines the solution of clicking on the UI and 3D objects
Thorough inquiry -- understanding and analysis of cocos2d source code
面经的总结
解决在docker中部署mysql8, 密码正确但无法登陆MySQL问题
C# 多个矩形围成的多边形标注位置的问题
Towords Open World Object Detection
How to judge whether a point is within a polygon (including complex polygons or a large number of polygons)
Robust and Efficient Quadrotor Trajectory Generation for Fast Autonomous Flight
SAP SALV14 后台输出SALV数据可直接保存文件,发送Email(带排序、超链接、筛选格式)