当前位置:网站首页>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
边栏推荐
猜你喜欢

Debug debugging in katalon
![[practice] 1364- implement a perfect waterfall flow component on the mobile terminal (with source code)](/img/e8/21d8d81a3d7b544687d6adc06ad4b1.png)
[practice] 1364- implement a perfect waterfall flow component on the mobile terminal (with source code)

mysql数据库概述以及安装过程

Wireless communication module fixed-point transmission - point to multipoint specific transmission application

移动命令

An idea plug-in that automatically generates unit tests, which improves the development efficiency by more than 70%!
Ribbon核心源码解析

Summary of spatial temporal time series prediction modeling methods

MySQL (I)

Remote connection of raspberry pie in VNC viewer mode without display
随机推荐
拼接String集合中的字符串_基于Stream
Katalon当中的使用循环for、while和if...else、break、continue
Katalon框架测试一个web页面操作实例代码
MySQL (III)
Xshell和Xftp使用教程
datetime与logging模块
壓縮解壓
JS foundation 5
JS foundation 6
Knowing the details of redis RDB, you can step on many holes less
MytipartFile与File的相互转换
Realize an air conditioner with compose to bring you cool in summer
[leetcode daily question] [December 19, 2021] 997 Find the town judge
ruoyi集成积木报表(nice)
Bytecode proof in appliedzkp zkevm (9)
JS基础4
Katalon framework tests web (XX) custom keywords and upload pop-up operations
JS基础5
广州海关支持保障食品、农产品和中药材等民生物资稳定供港
[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)