gpt4 book ai didi

mysql - MySQL 上用户 'user' @'localhost' 的访问被拒绝

转载 作者:搜寻专家 更新时间:2023-10-30 20:19:52 24 4
gpt4 key购买 nike

我正在尝试将我连接到数据库 MySQL 服务器,但控制台显示 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) 我不知道为什么。请帮我。在我的文件 my.cnf 中,我有这样的东西,

[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

enter image description here

谢谢。

最佳答案

如果你真的不记得pass了,你可以添加skip_grant_tables到你的my.cnf[mysqld]部分,重新启动服务器,它会让你在没有密码的情况下进入,然后你可以通过更新 mysql.user 表更改密码并重新启动 mysql 删除 skip_grant_tables 选项。

关于mysql - MySQL 上用户 'user' @'localhost' 的访问被拒绝,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11819047/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com