简体   繁体   English

PHP无法使用TCP连接到本地MariaDB服务器

[英]PHP can't connect to local MariaDB server using TCP

My laptop (which runs os x) had a little kernel panic over the weekend, so I had to forcefully restart it. 我的笔记本电脑(运行os x)在周末有一点内核恐慌,因此我不得不强行重启它。 –Unfortunately, a PHP app I'm developing can't connect to the MariaDB server running on it anymore using TCP, returning this pretty error message here: –不幸的是,我正在开发的PHP应用程序无法再使用TCP连接到在其上运行的MariaDB服务器,在此返回此错误消息:

Warning: mysqli::mysqli() [mysqli.mysqli]: [2002] Connection refused (trying to connect via tcp://127.0.0.1:3306)

I obtained MariaDB, Apache and PHP through MacPorts and I ran port upgrade outdated a few days ago, but my code hasn't changed at all. 我通过MacPorts获得了MariaDB,Apache和PHP,几天前我进行了port upgrade outdated ,但是我的代码完全没有改变。

Connecting to MariaDB with Sequel Pro using sockets works. 使用套接字通过Sequel Pro连接到MariaDB是可行的。

Apparantly, the newest version of MariaDB added skip-networking to my.cnf. 显然,最新版本的MariaDB在my.cnf中添加了skip-networking After commenting the line out and restarting the MariaDB service, everything seems to be working again. 在注释掉该行并重新启动MariaDB服务之后,一切似乎都可以再次使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM