If you're here, that means you've just installed phpMyAdmin in your mac system and encountered the following error
mysqli_real_connect(): (HY000/2002): No such file or directory
phpMyAdmin is one of the most popular CMS for PHP and MySQL database. But the default configuration has some issues with macOS. Let's see how it can be resolved.
Go to the file
config.sample.inc.php, it is in the root of the phpMyAdmin and open it in any editor, I'm opening in VSCode.
Now, in the file
config.sample.inc.php, find the line
$cfg['Servers'][$i]['host'] = 'localhost';
and change it into
$cfg['Servers'][$i]['host'] = '127.0.0.1';
The file will now look like the screenshot below.
Now this is the last step, all you have to do is to remove the sample from this config file and make it
That's it, now you will no longer get the error. Cheers 🥂