当前位置:网站首页>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
because 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 !
边栏推荐
- The ceiling of MySQL tutorial. Collect it and take your time
- MySQL教程的天花板,收藏好,慢慢看
- [untitled]
- Enterprises do not want to replace the old system that has been used for ten years
- ICLR 2022 | 基于对抗自注意力机制的预训练语言模型
- DR-Net: dual-rotation network with feature map enhancement for medical image segmentation
- 如何实现文字动画效果
- ACL 2022 | small sample ner of sequence annotation: dual tower Bert model integrating tag semantics
- Const keyword
- three. JS gorgeous bubble effect
猜你喜欢
2022-07-04 the high-performance database engine stonedb of MySQL is compiled and run in centos7.9
Rust knowledge mind map XMIND
#DAYU200体验官# 在DAYU200运行基于ArkUI-eTS的智能晾晒系统页面
Clip +json parsing converts the sound in the video into text
MySQL authentication bypass vulnerability (cve-2012-2122)
Dayu200 experience officer runs the intelligent drying system page based on arkui ETS on dayu200
Leetcode: interview question 17.24 Maximum cumulative sum of submatrix (to be studied)
MATLAB小技巧(27)灰色预测
Motion capture for snake motion analysis and snake robot development
ACL 2022 | small sample ner of sequence annotation: dual tower Bert model integrating tag semantics
随机推荐
AdaViT——自适应选择计算结构的动态网络
Comparison between variable and "zero value"
uniapp滑动到一定的高度后固定某个元素到顶部效果demo(整理)
How to choose the server system
[step on pit collection] attempting to deserialize object on CUDA device+buff/cache occupy too much +pad_ sequence
The ceiling of MySQL tutorial. Collect it and take your time
允许全表扫描 那个语句好像不生效set odps.sql.allow.fullscan=true;我
Plafond du tutoriel MySQL, bien collecté, regardez lentement
CocosCreator+TypeScripts自己写一个对象池
ACL 2022 | small sample ner of sequence annotation: dual tower Bert model integrating tag semantics
leetcode:面试题 17.24. 子矩阵最大累加和(待研究)
MySQL ---- first acquaintance with MySQL
[compilation principle] LR (0) analyzer half done
Traversal of a tree in first order, middle order, and then order
【全网首发】Redis系列3:高可用之主从架构的
Balanced Multimodal Learning via On-the-fly Gradient Modulation(CVPR2022 oral)
SQL server generates auto increment sequence number
做国外LEAD2022年下半年几点建议
Aardio - integrate variable values into a string of text through variable names
Export MySQL table data in pure mode