Tag Archives: You have an error in your SQL syntax

Mysql 8.0.13 Enabling remote access (ERROR 1064 (42000): You have an error in your SQL syntax; check the manual th)

preface

When opening remote access permission on windows, we searched a lot of information. Most of the commands explaining how to open remote MySQL remote service are as follows:

grant all privileges on *.* to 'root'@'%' identified by 'Your passwords' with grant option 

This method is not applicable to the version after MySQL 8.0.

you need to use the following command to start the remote service.

CREATE USER 'root'@'%' IDENTIFIED BY 'Your passwords'; 
GRANT ALL ON *.* TO 'root'@'%'; 
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'Your passwords';

After the three commands are executed in sequence, refresh the permissions:

FLUSH PRIVILEGES;

Actual effect: