当前位置:网站首页>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 !
边栏推荐
- MySQL教程的天花板,收藏好,慢慢看
- OpenNMS分离数据库
- Void keyword
- #DAYU200体验官# 在DAYU200运行基于ArkUI-eTS的智能晾晒系统页面
- Typescript get function parameter type
- Windows auzre background operation interface of Microsoft's cloud computing products
- three.js绚烂的气泡效果
- The statement that allows full table scanning does not seem to take effect set odps sql. allow. fullscan=true; I
- Financial professionals must read book series 6: equity investment (based on the outline and framework of the CFA exam)
- 做国外LEAD2022年下半年几点建议
猜你喜欢
随机推荐
Precise drag and drop within a contentable
Cloud native technology container knowledge points
npm无法安装sharp
OpenNMS separation database
如何实现文字动画效果
Puppeter connects to the existing Chrome browser
poj 1094 Sorting It All Out (拓扑排序)
使用云服务器搭建代理
室内LED显示屏应该怎么选择?这5点注意事项必须考虑在内
Introduction to network basics
第十九章 使用工作队列管理器(二)
Let's see through the network i/o model from beginning to end
【Unity】升级版·Excel数据解析,自动创建对应C#类,自动创建ScriptableObject生成类,自动序列化Asset文件
UE4 blueprint learning chapter (IV) -- process control forloop and whileloop
Is "applet container technology" a gimmick or a new outlet?
存币生息理财dapp系统开发案例演示
uniapp设置背景图效果demo(整理)
memcached
Pytest unit test series [v1.0.0] [pytest execute unittest test case]
案例推荐丨安擎携手伙伴,保障“智慧法院”更加高效









