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

按照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.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)

 

 

 

 

 

 

————————————————

版权声明:本文为CSDN博主「rogerix4」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。 原文链接:https://blog.csdn.net/qq_30797051/article/details/116189238

posted @ 2022-05-15 12:50  yl_diao  阅读(1848)  评论(0编辑  收藏  举报