mysql user localhost,MySQL上的用户“user”@“localhost”拒绝访问

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

7bd7d4b771b3d9263a5dcadb6f0692f9.png

Thanks.

解决方案

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.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值