码迷,mamicode.com
首页 > 数据库 > 详细

mysql8安装后如何修改root密码

时间:2019-07-05 00:15:56      阅读:145      评论:0      收藏:0      [点我收藏+]

标签:root密码   设置   错误   news   nbsp   如何   html   tps   class   

mysql5.7.9之后,就没有了password函数,所以,使用传统的password()函数修改root密码的话,就会提示sql错误

 

 UPDATE user SET authentication_string = password(‘123456‘) 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 ‘(‘123456‘) WHERE User=‘root‘‘ at line 1

 

 

正确设置密码的方法是:

ALTER USER ‘root‘@‘localhost‘ IDENTIFIED WITH mysql_native_password BY ‘123456‘;

此时提示修改成功,退出mysql再次登陆即需要输入刚刚设置的密码。

 

具体请参考文章:

https://newsn.net/say/mysql8-password.html

mysql8安装后如何修改root密码

标签:root密码   设置   错误   news   nbsp   如何   html   tps   class   

原文地址:https://www.cnblogs.com/saysmy/p/11135369.html

踩
(0)
赞
(0)
   
举报
评论 一句话评论(0)
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!