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

【实战】1364- 实现一个完美的移动端瀑布流组件(附源码)

How to use dataant to monitor Apache apisex

Information hidden in the trend chart of Hong Kong London gold market

动态库(共享库)的制作和使用

MarkDown——基本使用语法

Realize an air conditioner with compose to bring you cool in summer

linux中源码安装mysql数据库(centos)
![[practice] appium settings app is not running after 5000ms](/img/3c/5a7544561231a15a4bb5cfa9e102b3.png)
[practice] appium settings app is not running after 5000ms

建立自己的网站(11)

Yann Lecun's new paper: the road to building automatic agents
随机推荐
Fabric. How to use js brush?
Pop up and push in sequence of stack < difficulty coefficient >
JS基础6
flink1.15,支持mysql视图吗?我这边在table-name处配置视图名保存,找不到表。想
MySQL common commands for viewing database performance
Katalon global variable is referenced in testobject
Metersphere uses JS to refresh the current page
【agora】get 一个 agora_refptr 对象的用法示例
[QT] connect syntax reference implementation
DataEase安装升级
【LeetCode每日一题】【2021/12/19】997. 找到小镇的法官
JS基础10
JS基础5
MySQL cannot be opened. Flash back
Does flink1.15 support MySQL views? I configured the view name at the table name to save, but the table could not be found. Think
GCC简介
乌国家安全与国防委员会秘书:将对俄境内目标进行精确打击
How to use K-line diagram for technical analysis
拼接String集合中的字符串_基于Stream
Ribbon core source code analysis