MySQL上的用户“user”@“localhost”拒绝访问 [英] Access denied for user 'user'@'localhost' on MySQL

查看:2006
本文介绍了MySQL上的用户“user”@“localhost”拒绝访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试连接到数据库MySQL服务器,但控制台显示 错误1045(28000):访问拒绝用户'root'@'localhost'(使用密码: 我不知道为什么。请帮帮我。在我的文件 my.cnf 我有这样的,

I'm trying connect me to database MySQL server but the console show me ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) I don't know why. Please help me. In my file my.cnf I have something like this,

[mysqld]
datadir=/var/lib/mysql
socket=/tmp/mysql.sock
user=mysql
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1

# To allow mysqld to connect to a MySQL Cluster management daemon, uncomment
# these lines and adjust the connectstring as needed.
#ndbcluster
#ndb-connectstring="nodeid=4;host=localhost:3306"

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

[ndbd]
# If you are running a MySQL Cluster storage daemon (ndbd) on this machine,
# adjust its connection to the management daemon here.
# Note: ndbd init script requires this to include nodeid!
connect-string="nodeid=2;host=localhost:3306"

[ndb_mgm]
# connection string for MySQL Cluster management tool
connect-string="host=localhost:3306"

[client]
socket=/tmp/mysql.sock

>

感谢。

推荐答案

如果你真的不记得该通行了,可以添加 > > 部分中的 会让你没有密码,然后你可以通过更新 mysql.user 表更改密码,并重新启动mysql删除 skip_grant_tables 选项。

If you really don't remember the pass anymore, you can add skip_grant_tables to [mysqld] section of your my.cnf, restart server, it will let you in without a password, then you can change password by updating mysql.user table and restart mysql removing the skip_grant_tables option.

这篇关于MySQL上的用户“user”@“localhost”拒绝访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆