遇到这个报错?不知道怎么办?要哭了? ERROR 1064 (42000): You have an error in your sql syntax; check the manual that corresponds to your
遇到这个报错?不知道怎么办?要哭了?
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 '("123456") where user='root'' at line 1
MySQL grant的SQL命令其实在5.X之后就已经被弃用了
首先,你先检查一下你的Mysql版本, 大多数执行报错的mysql版本是8.0的。
mysql> grant all privileges on test.* to test@'%' 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 '123456'' at line 1
mysql> grant all privileges on test.* to test@'%' identified by '123456'; Query OK, 0 rows affected, 1 warning (0.08 sec)mysql> flush privileges;
那么在MySQL8.0版本及以后,我们如何正确执行grant呢?
先创建用户,再赋予授权。
mysql> create user test@'localhost' identified by '123456';
Query OK, 0 rows affected (0.10 sec)
mysql> grant all privileges on test.* to test@'localhost';
Query OK, 0 rows affected (0.17 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.18 sec)
这个方法也适用MySQL5.7版本,所以建议大家以后使用这种方式赋权,一键建用户加赋权官方已经弃用了。
来源地址:https://blog.csdn.net/qq_57309855/article/details/127602061
--结束END--
本文标题: ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your
本文链接: https://www.lsjlt.com/news/393032.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-10-23
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0