MySQL 8+ 开启root 用户远程访问

MySQL 8.0+ 之后开启远程访问报如下错误:

ERROR 1410 (42000): You are not allowed to create a user with GRANT

 

查看MySQL版本号:

mysql> select version();
+-----------+
| version() |
+-----------+
| 8.0.17    |
+-----------+
1 row in set (0.00 sec)

 

查看是否授权:

mysql> use mysql;
Database changed
mysql> select user, host from user;
+------------------+-----------+
| user             | host      |
+------------------+-----------+
|        | %         |
| mysql.infoschema | localhost |
| mysql.session    | localhost |
| mysql.sys        | localhost |
| root             | localhost |
+------------------+-----------+
8 rows in set (0.00 sec)

 

开启远程访问root(这个用户区别于本地root用户)用户: 

mysql> create user 'root'@'%' identified by 'dongde';
Query OK, 0 rows affected (0.02 sec)
	
mysql> grant all on *.* to 'root'@'%';
Query OK, 0 rows affected (0.02 sec)


 

你可能感兴趣的:(database,linux)