当前位置:   article > 正文

MySQL 8+ 更改root用户密码_mysql8 set root password

mysql8 set root password

查了网上的方法,有两种:

SET PASSWORD FOR 'root'@'localhost' = PASSWORD("your password");
  • 1

update user set password=PASSWORD("your password") where User='root';
  • 1

发现均在password函数附近报错

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...
  • 1

查看文档后发现PASSWORD函数已经被删除(原文),新的方法是

ALTER USER 'root'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'your passwd';
  • 1

返回Query OK

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/weixin_40725706/article/detail/310285
推荐阅读
相关标签
  

闽ICP备14008679号