当前位置:网站首页>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 !
边栏推荐
- Is there any requirement for the value after the case keyword?
- 服务器的系统怎么选者
- Precise drag and drop within a contentable
- 2022-07-04 the high-performance database engine stonedb of MySQL is compiled and run in centos7.9
- Hard core observation 545 50 years ago, Apollo 15 made a feather landing experiment on the moon
- CSDN 上传图片取消自动加水印的方法
- Enterprises do not want to replace the old system that has been used for ten years
- UVa 11732 – strcmp() Anyone?
- NPM cannot install sharp
- How to choose the server system
猜你喜欢
Thinkphp5 multi table associative query method join queries two database tables, and the query results are spliced and returned
Leetcode: interview question 17.24 Maximum cumulative sum of submatrix (to be studied)
European Bioinformatics Institute 2021 highlights report released: nearly 1million proteins have been predicted by alphafold
Word2vec (skip gram and cbow) - pytorch
MATLAB小技巧(27)灰色预测
ICLR 2022 | 基于对抗自注意力机制的预训练语言模型
专为决策树打造,新加坡国立大学&清华大学联合提出快速安全的联邦学习新系统
cuda 探索
Matlab tips (27) grey prediction
视图(view)
随机推荐
金融人士必读书籍系列之六:权益投资(基于cfa考试内容大纲和框架)
MySQL教程的天花板,收藏好,慢慢看
Precise drag and drop within a contentable
memcached
2014阿里巴巴web前实习生项目分析(1)
案例推荐丨安擎携手伙伴,保障“智慧法院”更加高效
儿童睡衣(澳大利亚)AS/NZS 1249:2014办理流程
The ceiling of MySQL tutorial. Collect it and take your time
Traversal of a tree in first order, middle order, and then order
MySQL ---- first acquaintance with MySQL
AdaViT——自适应选择计算结构的动态网络
CocosCreator+TypeScripts自己写一个对象池
Puppeter connects to the existing Chrome browser
Volatile keyword
[step on pit collection] attempting to deserialize object on CUDA device+buff/cache occupy too much +pad_ sequence
视图(view)
The difference between enumeration and define macro
Word2vec (skip gram and cbow) - pytorch
面试题:AOF重写机制,redis面试必问!!!
UE4 blueprint learning chapter (IV) -- process control forloop and whileloop