无法登录 MySQL 服务器 (PhpMyAdmin)

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

我通过 Homebrew 安装了 MySQL 和 PhpMyAdmin. 当我尝试使用 root 及其密码登录时出现以下错误:

I installed both MySQL and PhpMyAdmin via Homebrew. I get the following error when I try to login with root and its password:

Cannot log in to the MySQL server

我可以通过终端登录到 MySQL:

I can log in to MySQL via the terminal with:

mysql -u root -p

PhpMyAdmin 配置:

/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'cookie';
/* Server parameters */
$cfg['Servers'][$i]['host'] = '127.0.0.1';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'pass';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['AllowNoPassword'] = false;

我在 apache 上运行它.我在 stackoverflow 上尝试了所有解决方案,但它们似乎不起作用.有人可以帮我吗?

I'm running this on apache. I tried all the solutions on stackoverflow but they don't seem to work. Can anyone help me?

推荐答案

您可以同时使用 localhost127.0.0.1 作为主机声明.

You can use both localhost or 127.0.0.1 as host declaration.

在您的情况下,您可以尝试使用 localhost 并且它会起作用.

In your case you can try to use localhost and it will work.

相关文章