当前位置:网站首页>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
边栏推荐
- What are the total number of all courses of Mr. Tang Xiaoyang, who is very popular in CSDN (question mark)
- 利用Lambda表达式解决c#文件名排序问题(是100大还是11大的问题)
- Install and configure Taobao image NPM (cnpm)
- Common DOS commands
- ABAP 从CDS VIEW 发布OData Service示例
- SAP Excel 已完成文件级验证和修复。此工作簿的某些部分可能已被修复或丢弃。
- Unityshader Foundation
- 移动端布局(3D转换、动画)
- keytool: command not found
- Unity ugui determines the solution of clicking on the UI and 3D objects
猜你喜欢
随机推荐
int a = 1存放在哪
Custom time format (yyyy-mm-dd HH: mm: SS week x)
H5 local storage data sessionstorage, localstorage
c#读取INI文件和向ini文件写入数据
Mobile game performance optimization
Thorough inquiry -- understanding and analysis of cocos2d source code
利用Lambda表达式解决c#文件名排序问题(是100大还是11大的问题)
双面显示的shader
二叉树的深度
将单行文字自动适应到目标矩形框内
SampleCameraFilter
C# 读取注册表
Unity 获取一个资源被那些资源引用
Implementation of MySQL persistence
Unity 获取一个文件依赖的资源
js之DOM学习获取元素
C#操作注册表全攻略
SAP pi / PO rfc2restful publishing RFC interface is a restful example (proxy indirect method)
keytool: command not found
NodeJS(四) 字符读取









