错误1064(42000):您的SQL语法有错误;想要将密码配置为root用户 [英] ERROR 1064 (42000): You have an error in your SQL syntax; Want to configure a password as root being the user
本文介绍了错误1064(42000):您的SQL语法有错误;想要将密码配置为root用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我刚刚下载了WAMP.我想使用MySQL控制台为MySQL根用户配置密码.以前没有设置密码.
I have just downloaded WAMP. I want to configure a password for the MySQL root user using MySQL console. No password has been set previously.
以下是输入内容
mysql-> use mysql
Database changed
mysql-> UPDATE user
-> SET Password=PASSWORD<'elephant7'>
-> WHERE user='root';
错误1064(42000):您的SQL语法有错误;检查 与您的MySQL服务器版本相对应的手册 在第3行的'WHERE user ='root'附近使用的语法
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 'WHERE user='root'' at line 3
推荐答案
您可以使用:
SET PASSWORD FOR 'root' = PASSWORD('elephant7');
或者,最新版本:
SET PASSWORD FOR root = 'elephant7'
您还可以使用:
UPDATE user SET password=password('elephant7') WHERE user='root';
但是在Mysql 5.7中,字段密码不再存在,您必须使用:
but in Mysql 5.7 the field password is no more there, and you have to use:
UPDATE user SET authentication_string=password('elephant7') WHERE user='root';
致谢
这篇关于错误1064(42000):您的SQL语法有错误;想要将密码配置为root用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文