gpt4 book ai didi

MySQL 访问被拒绝错误

转载 作者:行者123 更新时间:2023-11-30 01:04:44 24 4
gpt4 key购买 nike

我正在尝试在 Mac OS 10.8 上安装 mySQL 并设置用户帐户。注意在终端窗口中使用命令行时,我是一个绝对的初学者。

我使用这些说明来安装: http://www.macminivault.com/mysql-mountain-lion/

我在这里为所有用户设置了自己的密码:

 GRANT ALL ON *.* TO 'root'@'localhost' IDENTIFIED BY 'mypass' WITH GRANT OPTION;
quit

每次我尝试在命令行上以 root 用户身份执行 mySQL 时,我都会得到以下信息:

Ciarans-MacBook-Pro:~ callanmooneys$ mysql -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

我在网上阅读并尝试了各种方法,包括尝试更改密码:

mysqladmin -u root -pyourcurrentmysqlrootpassword password yournewmysqlrootpassword,
it returns ->
-> USE mysql
->

如果我只是输入“mysql”并启动 mySQL 监视器,然后尝试创建一个用户帐户:

mysql> USE mysql
ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'mysql'
mysql>

还尝试了论坛上的答案:access is denied for user 'root'@localhost mysql error 1045返回'root@127.0.0.1 命令未找到

MySQL - ERROR 1045 - Access denied :

Ciarans-MacBook-Pro:~ callanmooneys$ mysqld_safe --skip-grant-tables
131105 21:44:41 mysqld_safe Logging to '/usr/local/mysql/data/Ciarans-MacBook-Pro.local.err'.
131105 21:44:41 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
/usr/local/mysql/bin/mysqld_safe: line 129: /usr/local/mysql/data/Ciarans-MacBook-Pro.local.err: Permission denied
/usr/local/mysql/bin/mysqld_safe: line 166: /usr/local/mysql/data/Ciarans-MacBook-Pro.local.err: Permission denied
131105 21:44:41 mysqld_safe mysqld from pid file /usr/local/mysql/data/Ciarans-MacBook-Pro.local.pid ended
/usr/local/mysql/bin/mysqld_safe: line 129: /usr/local/mysql/data/Ciarans-MacBook-Pro.local.err: Permission denied
Ciarans-MacBook-Pro:~ callanmooneys$ mysql -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
Ciarans-MacBook-Pro:~ callanmooneys$

感谢反馈。

最佳答案

有点令人困惑,但删除了 mySQL 和所有相关文件,重新安装,设置 root 密码,登录为mysql -u root -p(密码)而且效果很好。

网上有很多资源可能会令人困惑,对于遇到类似问题的任何人,我建议使用这里的官方网站:

http://dev.mysql.com/doc/refman/5.1/en/access-denied.html

关于MySQL 访问被拒绝错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19799763/

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