mysql8设置远程连接报错grant all privileges on . to ‘root’@’%’ identified by
mysql8中已经不支持grant all privileges on . to ‘root’@’%’ identified by ‘密码’ with grant option这种写法。
提示意思是不能用grant创建用户,mysql8.0以前的版本可以使用grant在授权的时候隐式的创建用户,8.0以后已经不支持,所以必须先创建用户,然后再授权,命令如下:
mysql> CREATE USER ‘root’@’%’ IDENTIFIED BY ‘Hadoop3!’;
Query OK, 0 rows affected (0.04 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.04 sec)
mysql> grant all privileges on . to ‘root’@’%’;
Query OK, 0 rows affected (0.03 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.03 sec)