当前位置:网站首页>Docker modifies the user name and password of MySQL
Docker modifies the user name and password of MySQL
2022-06-28 10:56:00 【Zhilan was born in a deep valley】
Docker modify Mysql Username and password
1、 Look at the container
[[email protected] ~]# docker ps -a

2、 Get into Mysql Containers
# Look at the picture above to find MySQL Container of id:801f2a6c6c94
[[email protected] ~]# docker exec -it 801f2a6c6c94 /bin/bash
3、 Get into etc/mysql file
[email protected]:/# cd etc/mysql
[email protected]:/etc/mysql# ls
conf.d my.cnf my.cnf.fallback mysql.cnf mysql.conf.d
4、 modify mysql The configuration file

Don't panic at this point , No, vim Then we'll give him a
# to update
apt-get update
# Import
apt-get install

This problem occurs when you import , Do not let import , Then let's update , Import after updating
[email protected]:/etc/mysql# apt-get update

Then you can import vim 了
[email protected]:/etc/mysql# apt-get install vim

Import vim Then modify the configuration file
[email protected]:/etc/mysql# vim my.cnf

[mysqld]
skip-host-cache
skip-name-resolve
skip-grant-tables Skip authority authentication
Save and exit
[email protected]:/# exit
restart mysql Containers
Look at the container first
[[email protected] ~]# docker ps -a

Restart container
[[email protected] ~]# docker restart mysql57
Get into mysql Containers , Connect mysql
[[email protected] ~]# docker exec -it mysql57 /bin/bash
# Here, reset the user name and password
[email protected]:/# mysql -uroot -p
Enter password:

Change Password
mysql> use mysql;
mysql> update user set authentication_string=password(' password ') where user='root';

Delete the line of authority authentication

skip-grant-tables Skip authority authentication This paragraph needs to be deleted , Otherwise, the subsequent login will be password free
[mysqld]
skip-host-cache
skip-name-resolve
skip-grant-tables Skip authority authentication
Refresh the permissions
mysql> flush privileges;

Test connection database
边栏推荐
- Dataease installation upgrade
- 线程和线程池
- Information hidden in the trend chart of Hong Kong London gold market
- [cloud resident co creation] detailed introduction to DWS alarm service DMS and cluster connection mode
- Katalon当中的debug调试
- 方法重写(Override)
- Who knows if it is safe to open an account with CSC securities
- MySQL(二)
- 知道 Redis RDB 这些细节,可以少踩很多坑
- Transactions proof in appliedzkp zkevm (10)
猜你喜欢
![[Li Kou - dynamic planning] sort out topic 1: basic topics: 509, 70, 746, 62, 63, 343, 96 (with links, topic descriptions, problem solving methods and codes)](/img/02/4dbd97c8b8df1c96b7c8e1460aeda2.png)
[Li Kou - dynamic planning] sort out topic 1: basic topics: 509, 70, 746, 62, 63, 343, 96 (with links, topic descriptions, problem solving methods and codes)

Realization of a springboard machine

移动命令

物联网5种无线传输协议特点大汇总

vsftpd服务的部署及优化

fastposter v2.8.4 发布 电商海报生成器

DlhSoft Kanban Library for WPF
![[monkey] Introduction to monkey test](/img/70/5a7152d0b6b77df7f9d6ad0e09e000.png)
[monkey] Introduction to monkey test

Yann LeCun新论文:构建自动智能体之路

JS基础8
随机推荐
压缩解压
JS基础5
JSON模块、hashlib、base64
Pop up and push in sequence of stack < difficulty coefficient >
sentinel
【monkey】monkey测试入门
GCC简介
方法重写(Override)
港伦敦金行情走势图所隐藏的信息
Redis database
Day 6 script and animation system
广州海关支持保障食品、农产品和中药材等民生物资稳定供港
datetime与logging模块
利用soapUI获取freemarker的ftl文件模板
BigDecimal 类的 compareTo() 和 equals()方法
获取系统当前日期
移动命令
Makefile简介
2D code generator for openharmony application development
JS基础1-JS引入与运算符