问题描述
我有一个MySQL安装在我的linux服务器,我忘了它的密码,所以我去和改变它使用我在网上找到的方法。我做了如下:
/etc/init.d/mysql stop
mysqld_safe --skip-grant表格&
mysql --user root mysql
SELECT * FROM user; //我检查了我是否可以访问用户表
update user SET password = PASSWORD('new_pass')WHERE user ='root';
刷新权限;
exit
更新查询更改了密码,因为它显示了受影响的行数和查询确定等。
然后我重新启动mysql
/ etc /init.d/mysql stop
/etc/init.d/mysql start
当我用新密码登录时
mysql -u root -p new_pass
它仍然会给我错误
错误1045(28000):访问被拒绝用户'root'@'localhost'密码:是)
有什么我缺少的吗?
解决方案实际上,我仔细看了mysql数据库中的用户表,在我之前编辑了ssl_type字段为用户root到SSL。
我编辑该字段并重新启动mysql,它的工作方式类似一个魅力。
谢谢。
I have a MySQL installed on my linux server, I forgot it's password so I went and changed it using the methods I found on the web. What I did was as follows:
/etc/init.d/mysql stop mysqld_safe --skip-grant-tables & mysql --user root mysql SELECT * FROM user; // I checked if I could access the user table or not update user SET password = PASSWORD('new_pass') WHERE user = 'root'; flush privileges; exit
The update query did change the password as it showed me the number of rows affected and Query OK etc.
Then I restarted mysql
/etc/init.d/mysql stop /etc/init.d/mysql start
Now when I logged in with the new password
mysql -u root -p new_pass
it still gives me errors"ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: Yes)"
Is there something that I am missing?
解决方案Actually I took a closer look at the user table in mysql database, turns out someone prior to me edited the ssl_type field for user root to SSL.
I edited that field and restarted mysql and it worked like a charm.
Thanks.
这篇关于访问被拒绝用户'root'@'localhost'(使用密码:是)密码重置后LINUX的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!