mysql8.0 配置远程连接用户

方式一: 已存在用户授权

mysql> use mysql;
## 确保下面语句执行为单一结果,结果多条增加筛选条件
mysql> select host,user from user where user='root';
mysql> update user set host='%' where user='root'; 
mysql> flush privileges;

方式二: 新建用户并授权

mysql> CREATE USER 'root'@'%' IDENTIFIED BY 'root';
## 语法模版 GRANT ALL PRIVILEGES ON 库名.表名 TO '用户名'@'IP地址' WITH GRANT OPTION;
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;
mysql> FLUSH PRIVILEGES;

你可能感兴趣的:(mysql)