ICode9

精准搜索请尝试: 精确搜索
首页 > 数据库> 文章详细

docker-compose中mysql修改身份验证方式

2022-07-22 13:31:21  阅读:206  来源: 互联网

标签:compose 0.0 身份验证 tcp hours user mysql localhost


[root@localhost zhi-docker]# docker ps

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES abcf3396c4fc free4inno/zhi-web:2.0.0 "/bin/bash /usr/loca…" 3 hours ago Up 3 hours 0.0.0.0:8081->8081/tcp, :::8081->8081/tcp, 0.0.0.0:8090->8090/tcp, :::8090->8090/tcp, 0.0.0.0:8888->80/tcp, :::8888->80/tcp zhi-web f5b9ee19dffa free4inno/zhimysql:1.1 "/entrypoint.sh --ch…" 3 hours ago Up 3 hours (healthy) 0.0.0.0:3306->3306/tcp, :::3306->3306/tcp, 33060/tcp zhimysql 61fbe4b00515 bolingcavalry/elasticsearch-with-ik:6.5.0 "/usr/local/bin/dock…" 3 hours ago Up 3 hours 0.0.0.0:9200->9200/tcp, :::9200->9200/tcp, 0.0.0.0:9300->9300/tcp, :::9300->9300/tcp zhies-node-1 69a731c44ff7 bolingcavalry/elasticsearch-head:6 "grunt server" 3 hours ago Up 3 hours 0.0.0.0:9100->9100/tcp, :::9100->9100/tcp zhies-head [root@localhost zhi-docker]# docker run zhimysql Unable to find image 'zhimysql:latest' locally
[root@localhost zhi-docker]# docker exec -it zhimysql bash bash-4.2# mysql -uroot -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 947 Server version: 8.0.18 MySQL Community Server - GPL Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> use mysql; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed mysql> select user,plugin from user where user='root'; +------+-----------------------+ | user | plugin | +------+-----------------------+ | root | caching_sha2_password | +------+-----------------------+ 1 row in set (0.00 sec) mysql> select user,host from user; +------------------+-----------+ | user | host | +------------------+-----------+ | root | % | | healthchecker | localhost | | mysql.infoschema | localhost | | mysql.session | localhost | | mysql.sys | localhost | +------------------+-----------+ 5 rows in set (0.00 sec) mysql> alter user 'root'@'%' identified with mysql_native_password by '123456'; Query OK, 0 rows affected (0.01 sec) mysql> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.00 sec)

  然后使用客户端连接数据库测试

标签:compose,0.0,身份验证,tcp,hours,user,mysql,localhost
来源: https://www.cnblogs.com/chenKnowledgeConllection/p/16505392.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有