当前位置:网站首页>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 vimEdit profile
vim /etc/mysql/mysql.conf.d/mysqld.cnfNeed 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 bashSign in mysql( No password required )
mysql -urootUpdate the permissions
flush privileges;Change Password
alter user 'root'@'localhost' identified by '123456';sign out mysql
exitnotes “skip-grant-tables”
Need comment “skip-grant-tables” Press i Press esc then :wq!
Exit the container
exitRestart container
docker restart mysqlIf 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 !
边栏推荐
- Sizeof keyword
- 室内LED显示屏应该怎么选择?这5点注意事项必须考虑在内
- Comparison between variable and "zero value"
- Slide the uniapp to a certain height and fix an element to the top effect demo (organize)
- Is "applet container technology" a gimmick or a new outlet?
- How to confirm the storage mode of the current system by program?
- Rust knowledge mind map XMIND
- hdu 5077 NAND(暴力打表)
- Precise drag and drop within a contentable
- config:invalid signature 解决办法和问题排查详解
猜你喜欢

Improving Multimodal Accuracy Through Modality Pre-training and Attention
![[leetcode] 19. Delete the penultimate node of the linked list](/img/ab/25cb6d6538ad02d78f7d64b2a2df3f.png)
[leetcode] 19. Delete the penultimate node of the linked list

Dayu200 experience officer homepage AITO video & Canvas drawing dashboard (ETS)

UE4蓝图学习篇(四)--流程控制ForLoop和WhileLoop

AdaViT——自适应选择计算结构的动态网络

Unified Focal loss: Generalising Dice and cross entropy-based losses to handle class imbalanced medi

uniapp滑动到一定的高度后固定某个元素到顶部效果demo(整理)

自定义 swap 函数

金融人士必读书籍系列之六:权益投资(基于cfa考试内容大纲和框架)

动作捕捉用于蛇运动分析及蛇形机器人开发
随机推荐
室内LED显示屏应该怎么选择?这5点注意事项必须考虑在内
【LeetCode】19、 删除链表的倒数第 N 个结点
MySQL ---- first acquaintance with MySQL
允许全表扫描 那个语句好像不生效set odps.sql.allow.fullscan=true;我
2022-07-04 the high-performance database engine stonedb of MySQL is compiled and run in centos7.9
关于声子和热输运计算中BORN电荷和non-analytic修正的问题
Custom swap function
The application of machine learning in software testing
UE4蓝图学习篇(四)--流程控制ForLoop和WhileLoop
cuda 探索
Windows Auzre 微软的云计算产品的后台操作界面
Bipartite graph determination
Clip +json parsing converts the sound in the video into text
Aardio - integrate variable values into a string of text through variable names
POJ 1094 sorting it all out
dockermysql修改root账号密码并赋予权限
Cocoscreator+typescripts write an object pool by themselves
【编译原理】做了一半的LR(0)分析器
CRMEB商城系统如何助力营销?
QT signal and slot