How to Fix \'mysqli_real_connect(): (HY000/2002): No such file or directory\' Error in phpMyAdmin for MacOS?

Susan Sarandon
Release: 2024-10-19 16:30:03
Original
690 people have browsed it

How to Fix

Resolving "mysqli_real_connect(): (HY000/2002): No such file or directory" Error in phpMyAdmin for MacOS

The "mysqli_real_connect(): (HY000/2002): No such file or directory" error in phpMyAdmin for MacOS occurs when PHP cannot establish a connection to the MySQL server. This issue arises when phpMyAdmin attempts to use localhost as the hostname for the MySQL server connection.

Solution:

To resolve this error, replace localhost with 127.0.0.1 in the phpMyAdmin configuration file (/etc/phpmyadmin/config.inc.php):

<code class="php">$cfg['Servers'][$i]['host'] = '127.0.0.1';</code>
Copy after login

By using 127.0.0.1, phpMyAdmin will establish a TCP connection to the MySQL server instead of attempting to use the mysql.socket, which is not available on MacOS.

The above is the detailed content of How to Fix \'mysqli_real_connect(): (HY000/2002): No such file or directory\' Error in phpMyAdmin for MacOS?. For more information, please follow other related articles on the PHP Chinese website!

source:php
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!