在mysql执行授权语句
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password'WITH GRANT OPTION;
时提示如下错误:
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 'Tibco123'WITH GRANT OPTION' at line 1
意识到版本问题后就百度mysql-8授权语句的语法,终于解决问题。
在Mysql 8版本中,不能使用
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password'WITH GRANT OPTION;
这一行命令来设置用户权限,必须分两步来实现设置用户权限【先创建用户、在对该用户分配用户权限】,最后刷新权限
mysql> CREATE USER 'root'@'%' IDENTIFIED BY 'password'; mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION; mysql> FLUSH PRIVILEGES;