Ad

mysqli_real_connect(): (HY000/2002): No such file or directory - PhpMyAdmin in macOS

mysqli_real_connect(): (HY000/2002): No such file or directory - PhpMyAdmin in macOS

|
11.33K

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.


Also read: DayJS: The best lightweight alternative to momentJS


Answer: 

Step 1: Edit the config file

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.

Go to fine config.sample.in.php

Step 2: Change the host value

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.

Chnage the host from localhost to 127.0.0.1

Step 3: Rename the config file

Now this is the last step, all you have to do is to remove the sample from this config file and make it config.inc.php

Rename the config file

That's it, now you will no longer get the error. Cheers 🥂

Ad


Comments

© 2024 Garbage Valuegarbage value logo