Mysql 8.0.13 开启远程访问权限(ERROR 1064 (42000): You have an error in your SQL syntax; check the manual th)

版权声明:资源类仅用于学习交流,禁止商用!!! https://blog.csdn.net/GentleCP/article/details/87936263

Mysql 8.0.13 开启远程访问权限 (ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘IDENTIFIED BY ‘xxx’ WITH GRANT OPTION’ at line 1)

在windows上开启远程访问权限的时候查找了许多资料,大多数解释开启远程Mysql远程服务的命令如下:

grant all privileges on *.* to 'root'@'%' identified by '你的密码' with grant option 

这种方法并不适用于Mysql 8.0以后的版本,
在这里插入图片描述
需要用如下命令开启远程服务。

CREATE USER 'root'@'%' IDENTIFIED BY '你的密码'; 
GRANT ALL ON *.* TO 'root'@'%'; 
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '你的密码';

三条命令按顺序执行完成后,刷新权限:

FLUSH PRIVILEGES;

实际效果:
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/GentleCP/article/details/87936263
今日推荐