我只是将我的Mac更新到10.13并重新安装了我的开发工具。 在设置phpmyadmin时,无法使用以下命令连接到mysql:
$cfg['Servers'][$i]['host'] = 'localhost';phpmyadmin抛出:
phpMyAdmin试图连接到MySQL服务器,服务器拒绝了连接。 您应该检查配置中的主机,用户名和密码,并确保它们与MySQL服务器管理员提供的信息相对应。
相反,我不得不使用它来工作:
$cfg['Servers'][$i]['host'] = '127.0.0.1';在过去,我可以离开默认的“本地主机”,并没有问题,但它不会再通过套接字连接。
我的mysql用户是'root'@'localhost',使用最新的mysql,apache,phpmyadmin。
可能是什么原因? 谢谢
I just updated my mac to 10.13 and reinstalled my dev tools. While setting up phpmyadmin it was unable to connect to mysql using:
$cfg['Servers'][$i]['host'] = 'localhost';phpmyadmin throws:
phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in your configuration and make sure that they correspond to the information given by the administrator of the MySQL server.
instead I had to use to get it working:
$cfg['Servers'][$i]['host'] = '127.0.0.1';In the past I could leave the default "localhost" and had no issues but it won't connect via socket any more.
My mysql user is 'root'@'localhost', using latest mysql, apache, phpmyadmin.
What could be the reason? Thanks
最满意答案
可能有一个以上的理由发生,同样的问题也在这个问题上讨论过。 我建议您阅读此问题提供的答案,以根据您所持有的环境解决错误。
这是ServerFault的问题 !
我倾向于在开发环境中看到的常见问题是:
您可能启用了IPv6 ,它的非常可能的本地主机解析为IPv6本地主机,它未在您的MySQL配置中定义。
Thanks to @N00b Pr0grammer's suggestion, I went trough the different solution still I figured it out.
On fresh installs of OS X, php.ini is turned off, and by default looks for mysqli.default_socket at "/var/mysql/mysql.sock" so I had to 1. rename php.ini.default to php.ini than 2. set:
mysqli.default_socket = /tmp/mysql.sockand restart apache. Now phpmyadmin is able to connect to mysql via localhost as well.
更多推荐
发布评论