数据库
首页 > 数据库> > Mysql8设置允许root用户远程访问

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

标签:grant,Mysql8,privileges,identified,PASSWD,mysql,root,远程
来源: https://www.cnblogs.com/diaoyulin/p/16272909.html