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 'You have an error in your SQL syntax' at line 1
前面也执行了create user 'root'@'%' identified by '123456';
到了grant all privileges on . to 'root'@'%' identified by 'root' with grant option ;就报这个错
8.0 赋权语句变了,要先 create user 然后才能 grant 权限。
你是不是在哪里复制了不完整的代码
grant all privileges on *.* to root@'%' identified by '123456' with grant option;