当前位置:网站首页>docker 安装mysql后进入容器内部发现登录不了mysql
docker 安装mysql后进入容器内部发现登录不了mysql
2022-07-27 08:04:00 【倒在程序员大门前】
1、修改配置文件my.cnf,在[mysqld]下加入以下代码
skip-grant-tables
2、重启容器
docker restart 容器ID
3、进入容器
docker exec -it 容器ID /bin/bash
# 4、登录mysql
mysql -uroot
# 5、做以下操作
//切换数据库
use mysql;
#更改加密方式
update user set plugin='mysql_native_password' where user='root';
#设置密码
alter user 'root'@'localhost' IDENTIFIED BY '123456';
#刷新权限表
flush PRIVILEGES;
# 6、注释掉my.cnf里的skip-grant-tables
# 7、重启容器
docker restart 容器ID
边栏推荐
- Lua stateful iterator
- Shell Scripts相关
- How does kettle handle text data transfer as' 'instead of null
- Things come to conform, the future is not welcome, at that time is not miscellaneous, neither love
- 【万字长文】吃透负载均衡,和阿里大牛的技术面谈
- 浅谈数据安全
- How does slf4j configure logback?
- SQL labs SQL injection platform - level 1 less-1 get - error based - Single Quotes - string (get single quote character injection based on errors)
- Leetcode54. Spiral matrix
- [resolved] the new version of pychart (2022) connects to the server to upload files and reports an error of "command Rsync is not found in path", and the files cannot be synchronized
猜你喜欢

Grandson's questions are difficult, and his son's invigilation is strict. I can't do it. Pay back my school money

存储过程与函数

Dasctf2022.07 enabling game password WP

Combined use of C WinForm form form event and delegate

Day111. Shangyitong: integrate nuxt framework, front page data, hospital details page

物联网工业级UART串口转WiFi转有线网口转以太网网关WiFi模块选型

Lu Xun: I don't remember saying it, or you can check it yourself!

【飞控开发基础教程4】疯壳·开源编队无人机-串口(光流数据获取)

On data security

Do me a favor ~ don't pay attention, don't log in, a questionnaire in less than a minute
随机推荐
Abstract factory pattern
Practical new drug R & D project management platform
北京五日游记
How to update PIP3? And running PIP as the 'root' user can result in broken permissions and conflicting behavior
How to obtain the cash flow data of advertising services to help analyze the advertising effect?
【目标检测】YOLOv6理论解读+实践测试VisDrone数据集
Install tensorflow
增强:BTE流程简介
Happy holidays, everyone
Leetcode56. Consolidation interval
On data security
[applet] how to get wechat applet code upload key?
Grandson's questions are difficult, and his son's invigilation is strict. I can't do it. Pay back my school money
MCU multi-level menu
Combined use of C WinForm form form event and delegate
Qt Creator代码风格插件Beautifier
Shell Scripts相关
Dormitory access control system made by imitating the boss (III)
C# 事件用法案例 订阅事件+=
帮个忙呗~不关注不登录,不到一分钟的一个问卷