• MySQL 8.0 及以上版本的用户授权语句和之前版本不同,老版本的常用授权语句,在 MySQL 8.0 版本中 已不能使用,如使用旧版本授权语句会报错。
mysql> GRANT ALL PRIVILEGES ON *.* TO `lansky`@`%` IDENTIFIED BY '123456' 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 '000000' WITH GRANT OPTION' at line 1
  • 在 MySQL 8.0 及以上版本中正确授权语句
mysql> CREATE USER 'lansky'@'%' IDENTIFIED BY '123456';
mysql> GRANT ALL ON *.* TO 'lansky'@'%' WITH GRANT OPTION;
Last modification:April 4th, 2022 at 06:49 pm
If you think my article is useful to you, please feel free to appreciate