我正在尝试启动并运行MySQL和phpMyAdmin但是在登录phpMyAdmin时遇到问题.当使用没有密码的默认用户名"root"和我通过终端设置的密码时,我得到"#2002无法登录MySQL服务器".
这是我的config.inc.php文件的相关部分:
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['port'] = '';
$cfg['Servers'][$i]['socket'] = '';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['user'] = 'admin'; //I have also tried 'root' here with no password
$cfg['Servers'][$i]['password'] = 'PASSWORD';
$cfg['Servers'][$i]['AllowNoPassword'] = true;
Run Code Online (Sandbox Code Playgroud)
我尝试过的:
我完全陷入困境.
系统/版本细节:Mac OSX 10.7.5 phpMyAdmin 3.5.7 MySQL 5.5.28
如果你使用localhost,它将尝试通过套接字访问mysql.您可以尝试以下两种方法之一:
localhost以127.0.0.1/var/mysql/mysql.sock,以/tmp/mysql.sock在php.ini您还应该进行一些健全性检查,例如通过使用您用于phpMyAdmin的用户名/密码连接到数据库来确保数据库已启动并运行.