navicat连不上centos上安装的mysql

在centos上安装好的mysql容器,在windows上的navicat连不上

docker exec -it 606ad8c5b31a(容器id) /bin/bash

 登录mysql

mysql -u root -p123456   (-p123456中间没有空格) 

赋予任何主机都能访问mysql


mysql>use mysql; 

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'WITH GRANT OPTION;

mysql>FLUSH PRIVILEGES;       //刷新数据

 如果你想允许用户root从ip为192.168.1.1的主机连接到mysql服务器并使用123456作为密码

GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.1.1' IDENTIFIED BY '123456' WITH GRANT OPTION;

FLUSH   PRIVILEGES;

 如果你想允许用户root从ip为192.168.1.6的主机连接到mysql服务器的dk数据库,并使用123456作为密码

GRANT ALL PRIVILEGES ON dk.* TO 'root'@'192.168.1.6' IDENTIFIED BY '123456' WITH GRANT OPTION;

FLUSH   PRIVILEGES;

修改密码加密方式

mysql>ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '你的密码';

mysql>FLUSH PRIVILEGES;       //刷新数据

reboot重启

你可能感兴趣的:(mysql)