当前位置:网站首页>Dockermysql modifies the root account password and grants permissions
Dockermysql modifies the root account password and grants permissions
2022-07-06 22:54:00 【1024 questions】
Start
install vim
Recently, I encountered a big resignation of programmers , I took over the mess of others .
modify docker in mysql Of root The account number and password of the account
So record it
Startland CentOs linux After the server
docker ps // see docker Mirror image
Into the mirror mysql Mirror inside
docker exec -it Mirror image id Or image alias /bin/bash // Get into docker Internal mirror
install vimbecause docker There is no band inside the image vim command , So manual installation is required , You can also use docker cp The command is copied from the host
apt-get updateapt-get install vim
Edit profile
vim /etc/mysql/mysql.conf.d/mysqld.cnf
Need to add “skip-grant-tables” Press i cv Join in "skip-grant-tables" Press esc then :wq!
Save and exit
exit # Exit the container
restart mysql Containers
docker restart mysql
Enter the container again
docker exec -it mysql bash
Sign in mysql( No password required )
mysql -uroot
Update the permissions
flush privileges;
Change Password
alter user 'root'@'localhost' identified by '123456';
sign out mysql
exit
notes “skip-grant-tables”
Need comment “skip-grant-tables” Press i Press esc then :wq!
Exit the container
exit
Restart container
docker restart mysql
If it can be accessed internally ,Navicat I can't wait to visit , Then execute mysql Open access
error :ERROR 1130: Host 'ip' is not allowed to connect to thisMySQL serve
reason : Connected data is not allowed ip visit , Only use is allowed localhost;
Get into mysql Mirror image
docker exec -it Mirror image id Or image alias /bin/bash // Get into docker Internal mirror
land mysql
mysql -u root -p Enter the password you just changed
mysql>use mysql;mysql>select 'host' from user where user='root';mysql>update user set host = '%' where user ='root';mysql>flush privileges;mysql>select 'host' from user where user='root';
If not, there are many root jurisdiction Update the permissions
update user set password=password("root") where user="root"; If the report has a primary key id
Then delete it localhost
This is about docker mysql modify root That's all for the article about account password and authorization , More about docker mysql modify root Please search the previous articles of software development network or continue to browse the relevant articles below. I hope you will support software development network more in the future !
边栏推荐
- poj 1094 Sorting It All Out (拓扑排序)
- Jafka source analysis processor
- Some suggestions for foreign lead2022 in the second half of the year
- memcached
- Adavit -- dynamic network with adaptive selection of computing structure
- rust知识思维导图xmind
- 2022-07-05 use TPCC to conduct sub query test on stonedb
- Method of canceling automatic watermarking of uploaded pictures by CSDN
- 第十九章 使用工作队列管理器(二)
- cuda 探索
猜你喜欢
Signed and unsigned keywords
View
leetcode:面试题 17.24. 子矩阵最大累加和(待研究)
室内LED显示屏应该怎么选择?这5点注意事项必须考虑在内
Aardio - integrate variable values into a string of text through variable names
UE4 blueprint learning chapter (IV) -- process control forloop and whileloop
金融人士必读书籍系列之六:权益投资(基于cfa考试内容大纲和框架)
[compilation principle] LR (0) analyzer half done
【Unity】升级版·Excel数据解析,自动创建对应C#类,自动创建ScriptableObject生成类,自动序列化Asset文件
How to choose indoor LED display? These five considerations must be taken into account
随机推荐
The ceiling of MySQL tutorial. Collect it and take your time
UE4蓝图学习篇(四)--流程控制ForLoop和WhileLoop
2014 Alibaba web pre intern project analysis (1)
儿童睡衣(澳大利亚)AS/NZS 1249:2014办理流程
How big is the empty structure?
Enterprises do not want to replace the old system that has been used for ten years
Const keyword
Custom swap function
Interview question: AOF rewriting mechanism, redis interview must ask!!!
案例推荐丨安擎携手伙伴,保障“智慧法院”更加高效
Typescript get function parameter type
memcached
OpenSSL:适用TLS与SSL协议的全功能工具包,通用加密库
Puppeteer连接已有Chrome浏览器
poj 1094 Sorting It All Out (拓扑排序)
How to achieve text animation effect
memcached
What are the specific steps and schedule of IELTS speaking?
CRMEB商城系统如何助力营销?
View