P粉1333218392023-08-28 16:05:31
I encountered the same problem, but the problem was related to the php.ini
file.
I had to edit these two lines in /etc/php.ini
(or wherever your php.ini
is):
mysql.default_socket = /tmp/mysql.sock mysqli.default_socket = /tmp/mysql.sock
Restart the apache server to ensure changes are reflected.
sudo apachectl restart
P粉3203612012023-08-28 13:51:31
Okay, I just found the solution. It turns out that the problem is that the host should not be localhost
, but 127.0.0.1
. I always thought localhost
and 127.0.0.1
were the same, but the results are different.
So, maybe as a tip to future users, always use IP when in doubt.