一:报错信息
执行命令:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456'
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 'superbruce' WITH GRANT OPTION' at line 1
这种方法并不适用于Mysql 8.0以后的版本,
需要用如下命令开启远程服务。
CREATE USER 'root'@'%' IDENTIFIED BY '你的密码';
GRANT ALL ON *.* TO 'root'@'%';
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '你的密码';
三条命令按顺序执行完成后,刷新权限:
FLUSH PRIVILEGES;