按照mysql8.0以前的方法修改报错
mysql> grant all privileges on *.* to 'root'@'%' identified by 'PASSWD';

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right

Mysql8设置允许root用户远程访问_ide

mysql8.0以后采用新的语法
create user 'root'@'%' identified by 'PASSWD';
grant all privileges on *.* to 'root'@'%';
mysql> create user 'root'@'%' identified by 'a123456';
Query OK, 0 rows affected (0.00 sec)
mysql> grant all privileges on *.* to 'root'@'%';
Query OK, 0 rows affected (0.00 sec)