mysql修改用户密码报ERROR 1064 (42000): YOU HAVE AN ERROR IN YOUR SQL
Author:zhoulujun Date:
我想修改mysql 用户密码,执行如下语句:
update User set password=password('test123') where user='tester' and host='localhost';
报语法错误:
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 'password('test123')' at line 1
网上搜索的答案大致如下:
这个问题是语法上的错误,在MySQL中,为了区分MySQL的关键字与普通字符,MySQL引入了一个反引号。
在上述的sql语句中,数据库名称使用的是单引号而不是反引号,所以会就报了这个错误出来。
试过反引号、单引号,都还是报上述错误
换一个方式修改用户名
mysqladmin -u tester -p test_abc password test123
set password for tester@localhost = password('test123');
还是不行,
msyql 修改用户密码的方法,就这三种吧
mysqladmin -u tester -p test_abc password test123
set password for tester@localhost = password('test123');
update User set password=password('test123') where user='tester' and host='localhost';
哪一种都不行。
最后google搜索一下,发现了解决方案:
ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';——来源与:https://blog.csdn.net/qq_43290288/article/details/115279488
具体原因是啥,个人不清楚,大佬路过请大佬解答下,多谢!
转载本站文章《mysql修改用户密码报ERROR 1064 (42000): YOU HAVE AN ERROR IN YOUR SQL》,
请注明出处:https://www.zhoulujun.cn/html/DB/mysql/2021_1220_8728.html