phpMyAdmin - 什么'下一个配置有误吗?
尝试在我的 Fedora 服务器上安装 phpMyAdmin,但是如果我在浏览器中打开它,我会收到下一个错误:
2002 无法登录到 MySQL 服务器
文件 config.inc.php 有下一个内容:
<?php
/* Servers configuration */
$i = 0;
/* Server: localhost [1] */
$i++;
$cfg['Servers'][$i]['verbose'] = '';
$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'] = 'root';
$cfg['Servers'][$i]['password'] = '123';
/* End of servers configuration */
$cfg['blowfish_secret'] = '4c45c50fe8b283.01675296';
$cfg['DefaultLang'] = 'en-utf-8';
$cfg['ServerDefault'] = 1;
$cfg['UploadDir'] = '';
$cfg['SaveDir'] = '';
?>
只是添加,在 mysql 中我创建了用户 root ,密码为 123,这样我就可以登录:
mysql -h localhost -u root -p123
你能帮我看看问题出在哪里吗?
tryin to install phpMyAdmin on my Fedora server, but if i open it in browser, i get next error:
2002 Cannot log in to the MySQL server
file config.inc.php have next content:
<?php
/* Servers configuration */
$i = 0;
/* Server: localhost [1] */
$i++;
$cfg['Servers'][$i]['verbose'] = '';
$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'] = 'root';
$cfg['Servers'][$i]['password'] = '123';
/* End of servers configuration */
$cfg['blowfish_secret'] = '4c45c50fe8b283.01675296';
$cfg['DefaultLang'] = 'en-utf-8';
$cfg['ServerDefault'] = 1;
$cfg['UploadDir'] = '';
$cfg['SaveDir'] = '';
?>
just to add, in mysql i created user root, with password 123, so i can log in with:
mysql -h localhost -u root -p123
can you help me where is the problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
mysql -h localhost
实际上通过 unix 套接字 而不是到 127.0.0.1 的 TCP 连接。另一方面,显式指定mysql -h 127.0.0.1
确实使用 TCP 方法。所以你正在测试的是本地套接字连接,而不是网络连接。确保 phpMyAdmin 使用相同的方法;该行
可能应该显示
您的 mysqld 可能有 网络已禁用或用户权限拒绝从网络进行 root/123 访问。
在您的示例中使用
-h localhost
您实际上是通过命名套接字进行连接。您可以亲自查看 - 从 mysql 客户端输入“\s”:mysql -h localhost
actually connects via unix socket instead of a TCP connection to 127.0.0.1. Explicitly specifyingmysql -h 127.0.0.1
on the other hand does use the TCP method.So what you are testing is a local socket connection, not a network one. Make sure phpMyAdmin uses the same method; the line
should probably read
Your mysqld probably has either networking disabled or user permissions denying root/123 access from the network.
With
-h localhost
in your example you are actually connecting over a named socket. You can see for yourself - from the mysql client type "\s":好的,我解决了。
在配置文件中,我刚刚将“localhost”更改为“127.0.0.1”,它就开始工作了。
tnx anw!
ok, i solve it.
in configuration file, i just changed 'localhost' to '127.0.0.1', and it started to work.
tnx anw!