PHP Warning: mysqli_real_connect(): (HY000/2002): No such file or directory in

Issue Summary

When starting the local Wordpress on local I can login into the site, change elements in eloementor etc, BUT when I go to the dashboard, I get the following message : “There has been a critical error on this website. Please check your site admin email inbox for instructions.”

So I checked the error.logs and there the issue seems to be PHP Warning: mysqli_real_connect(): (HY000/2002): No such file or directory in… First I thought, that it would be a disk space issue but that did not work, so I would appreciate a bit of help.

Troubleshooting Questions

How to fix “PHP Warning: mysqli_real_connect(): (HY000/2002): No such file or directory in…”?

Replication

System Details

newest local version

macOS Catalina

[16-Jul-2022 09:56:02 UTC] PHP Warning: mysqli_real_connect(): (HY000/2002): No such file or directory in /Users/felixhermann/Local Sites/bonculina/app/public/wp-includes/wp-db.php on line 1753
[16-Jul-2022 09:56:02 UTC] PHP Stack trace:
[16-Jul-2022 09:56:02 UTC] PHP 1. {main}() /Applications/Local.app/Contents/Resources/extraResources/bin/wp-cli/wp-cli.phar:0
[16-Jul-2022 09:56:02 UTC] PHP 2. include() /Applications/Local.app/Contents/Resources/extraResources/bin/wp-cli/wp-cli.phar:4
[16-Jul-2022 09:56:02 UTC] PHP 3. include() phar:///Applications/Local.app/Contents/Resources/extraResources/bin/wp-cli/wp-cli.phar/php/boot-phar.php:11
[16-Jul-2022 09:56:02 UTC] PHP 4. WP_CLI\bootstrap() phar:///Applications/Local.app/Contents/Resources/extraResources/bin/wp-cli/wp-cli.phar/vendor/wp-cli/wp-cli/php/wp-cli.php:27
[16-Jul-2022 09:56:02 UTC] PHP 5. WP_CLI\Bootstrap\LaunchRunner->process() phar:///Applications/Local.app/Contents/Resources/extraResources/bin/wp-cli/wp-cli.phar/vendor/wp-cli/wp-cli/php/bootstrap.php:78
[16-Jul-2022 09:56:02 UTC] PHP 6. WP_CLI\Runner->start() phar:///Applications/Local.app/Contents/Resources/extraResources/bin/wp-cli/wp-cli.phar/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php:28
[16-Jul-2022 09:56:02 UTC] PHP 7. WP_CLI\Runner->load_wordpress() phar:///Applications/Local.app/Contents/Resources/extraResources/bin/wp-cli/wp-cli.phar/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php:1235
[16-Jul-2022 09:56:02 UTC] PHP 8. require() phar:///Applications/Local.app/Contents/Resources/extraResources/bin/wp-cli/wp-cli.phar/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php:1317
[16-Jul-2022 09:56:02 UTC] PHP 9. require_wp_db() /Users/felixhermann/Local Sites/bonculina/app/public/wp-settings.php:124
[16-Jul-2022 09:56:02 UTC] PHP 10. wpdb->__construct() /Users/felixhermann/Local Sites/bonculina/app/public/wp-includes/load.php:561
[16-Jul-2022 09:56:02 UTC] PHP 11. wpdb->db_connect() /Users/felixhermann/Local Sites/bonculina/app/public/wp-includes/wp-db.php:724
[16-Jul-2022 09:56:02 UTC] PHP 12. mysqli_real_conne

Security Reminder

Local does a pretty good job of scrubbing private info from the logs and the errors it produces, however there’s always the possibility that something private can come through. Because these are public forums, always review the screenshots you are sharing to make sure there isn’t private info like passwords being displayed.

Hi @webfixdev! Have you been able to troubleshoot any of the plugins or themes on the site? Oftentimes that critical error message is indicative of some type of conflict. You might try disabling everything, and then re-enabling one a time to see if anything causes the error to come back up.

Hey, thank you for the fast reply. The problem is that I am not able to enter the interface, so I cannot disable the plugins. Do you have a suggestion?

Hello again! If you go back to your Local app can you open the site shell? That will allow you use WP CLI commands to view/activate/deactivate plugins or swap themes on the site.

oh, that’s great, thank you. I a little new to local, so thank you for the tip

1 Like

No problem and welcome to Local!

I’ve found I see that specific error when I’m just starting local. I think it’s trying to load the site before Local has been fully loaded.

1 Like

So I deactivated all new plugins I installed, and there was no resolving of the error. When inspecting with Chrome inspector I get this : “Failed to load resource: the server responded with a status of 500 (Internal Server Error)”, so I don’t think the plugins are causing the error. Any suggestions?

Oh ok, and do you have a way to solve this from happening?

Hey guys all good, I figured it out. The problem was W3 plugin, because I am working on local, it gave the app some problems with its caching and async methodes. Thanks for the help!

1 Like

This topic was automatically closed 36 hours after the last reply. New replies are no longer allowed.