IT

mysql连接远程数据库

Mysql8以下

前提:防火墙mysql得删掉或者允许通过

mysql -uroot -p
use mysql;
// 添加一个root账户密码为password让任意主机登录该数据库
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'IDENTIFIED BY 'password' WITH GRANT OPTION;
// 刷新Mysql配置
FLUSH PRIVILEGES;

Mysql8

mysql -uroot -p
use mysql;
// 查询状态
select user,authentication_string,host from user;
// 更新root的访问域为所有
update user set host = '%' where user = 'root';
// 刷新Mysql配置
FLUSH PRIVILEGES;
//navicat 连接 mysql 出现`Client does not support authentication protocol requested by server`
// 修改密码字段
alter user 'root'@'%' identified with mysql_native_password by '密码';

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注