最初,mysql -u root工作得很好。
然后,我尝试使用以下命令重置root用户密码
UPDATE set authentication_string=PASSWORD("password") where User='root';但当我尝试mysql -u root -ppassword时,它抛出了
access denied for user 'root'@'localhost' (using password: NO)发布于 2020-12-19 20:34:22
因此,要修复上述解决方案,请执行以下步骤:
使用which mysql首先搜索
/usr/local/bin/mysql
运行cd /usr/local/bin
mysql.server文件并执行mysql.server stop,然后执行
输出为:
关闭MySQL
。成功!
killall mysqld mysqld_safemysqld_safe --skip-grant-tables &mysql -u root it will work因此,下一步是将根密码更新回<no-password>
运行use mysql;
Update user set authentication_string='' where User='root';的
注意:要更新mysql 8.0+密码,请始终使用
ALTER USER 'root'@'localhost' IDENTIFIED BY 'newpassword';https://stackoverflow.com/questions/65369861
复制相似问题