无法使用 mySQL 的 root 密码登录到 phpMyAdmin(在 Mac OS X Lion 上)

2022-01-05 00:00:00 osx-lion mysql phpmyadmin

所以我尝试使用我的 root 密码(用户名:root 密码:******)登录 phpMyAdmin,但是,我继续收到错误:#2002 无法登录 MySQL 服务器

我很确定我知道 root 密码,因为我已经在 Mac OS X 的终端中输入了一行:

sudo/usr/local/mysql/support-files/mysql.server start

并被提示输入 "Password:" 行.我输入密码,终端显示:

启动 MySQL...成功! 这样服务器就启动了.我不确定为什么相同的密码不适用于 phpMyAdmin.

我尝试使用以下命令在终端中设置密码:

/usr/local/mysql/bin/mysqladmin -u root 密码 *******

但我收到输出:

/usr/local/mysql/bin/mysqladmin: 在 'localhost' 连接到服务器失败错误:'用户'root'@'localhost'的访问被拒绝(使用密码:NO)'

我非常感谢您的帮助.我对此无能为力.我试过好几个网站,mySQL 的说明在这件事上没用.有关如何解决此问题的详细说明(在 Mac OS X Lion 上)将非常有帮助.谢谢你.

更新:

我一直在尝试重置 root 密码,并一直遵循以下说明:http://www.coolestguyplanet.net/how-to-change-the-mysql-root-password/

但是,当我使用命令时:/usr/local/mysql/bin/mysqld_safe --skip-grant-tables

我收到以下输出:

111217 10:00:42 mysqld_safe 登录到/usr/local/mysql/data/******-********-MacBook-Pro.local.err".111217 10:00:42 mysqld_safe 使用来自/usr/local/mysql/data 的数据库启动 mysqld 守护进程/usr/local/mysql/bin/mysqld_safe:第107行:/usr/local/mysql/data/********-********-MacBook-Pro.local.err:权限被拒绝/usr/local/mysql/bin/mysqld_safe: line 144:/usr/local/mysql/data/********-************-MacBook-Pro.local.err:没有权限111217 10:00:42 来自 pid 文件的 mysqld_safe mysqld/usr/local/mysql/data/*********-********-MacBook-Pro.local.pid 结束/usr/local/mysql/bin/mysqld_safe:第107行:/usr/local/mysql/data/*******-*********-MacBook-Pro.local.err:权限被拒绝**********-*********-MacBook-Pro:~我的名字$

为什么我的许可会被拒绝??

解决方案

config.inc.php 中将 localhost 更改为 127.0.0.1对于 $cfg['Servers'][$i]['host'] 键.

So I am trying to log in to phpMyAdmin using my root password (Username: root Password: ******), however, I continue to receive the error: #2002 Cannot log in to the MySQL server

I am pretty sure I know the root password, as I have typed into terminal on Mac OS X the line:

sudo /usr/local/mysql/support-files/mysql.server start

and was prompted with a "Password:" line. I typed the password, and the terminal read:

Starting MySQL...SUCCESS! And thus the server started up. I am not sure why the same password is not working for phpMyAdmin.

I have tried setting the password in terminal with the command:

/usr/local/mysql/bin/mysqladmin -u root password *******

But I receive the output:

/usr/local/mysql/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)' 

I would very much appreciate help. I am at my wits end with this. I have tried several websites, and the mySQL instructions are useless on this matter. A detailed explanation on how to solve this problem (on Mac OS X Lion) would be very helpful. Thank you.

Update:

I've been trying to reset the root password, and have been following these instructions: http://www.coolestguyplanet.net/how-to-change-the-mysql-root-password/

However, when I use the command: /usr/local/mysql/bin/mysqld_safe --skip-grant-tables

I receive the following output:

111217 10:00:42 mysqld_safe Logging to '/usr/local/mysql/data/******-********-MacBook-Pro.local.err'.
111217 10:00:42 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
/usr/local/mysql/bin/mysqld_safe: line 107: /usr/local/mysql/data/********-********-MacBook-Pro.local.err: Permission denied
/usr/local/mysql/bin/mysqld_safe: line 144: /usr/local/mysql/data/*******-**********-MacBook-Pro.local.err: Permission denied
111217 10:00:42 mysqld_safe mysqld from pid file /usr/local/mysql/data/*********-********-MacBook-Pro.local.pid ended
/usr/local/mysql/bin/mysqld_safe: line 107: /usr/local/mysql/data/*******-*********-MacBook-Pro.local.err: Permission denied
**********-*********-MacBook-Pro:~ myname$ 

Why would my permission be denied??

解决方案

In config.inc.php change localhost to 127.0.0.1 for $cfg['Servers'][$i]['host'] key.

相关文章