Mysqli_real_connect() connection refused

Hello,

I’ve recently decided to give Local another go, but I’m having issues getting one of my sites started. Currently when I start up a site, it simply shows the PHP code for the WordPress index.php file. At first my logs file detected a PHP error (which I fixed), but now I’m simply getting a MySQL connect error. I’ve attempted to clean out my hosts file, but that doesn’t seem to have fixed anything. I was wondering if someone might be able to help point me in the right direction.

Here’s the pertinent error in my PHP log file:
[03-Feb-2019 19:04:30 UTC] PHP Warning: mysqli_real_connect(): (HY000/2002): Connection refused in /app/public/wp-includes/wp-db.php on line 1531
[03-Feb-2019 19:04:30 UTC] PHP Stack trace:
[03-Feb-2019 19:04:30 UTC] PHP 1. {main}() /usr/local/bin/wp:0
[03-Feb-2019 19:04:30 UTC] PHP 2. include() /usr/local/bin/wp:4
[03-Feb-2019 19:04:30 UTC] PHP 3. include() phar:///usr/local/bin/wp/php/boot-phar.php:8
[03-Feb-2019 19:04:30 UTC] PHP 4. WP_CLI\bootstrap() phar:///usr/local/bin/wp/php/wp-cli.php:23
[03-Feb-2019 19:04:30 UTC] PHP 5. WP_CLI\Bootstrap\LaunchRunner->process() phar:///usr/local/bin/wp/php/bootstrap.php:75
[03-Feb-2019 19:04:30 UTC] PHP 6. WP_CLI\Runner->start() phar:///usr/local/bin/wp/php/WP_CLI/Bootstrap/LaunchRunner.php:23
[03-Feb-2019 19:04:30 UTC] PHP 7. WP_CLI\Runner->load_wordpress() phar:///usr/local/bin/wp/php/WP_CLI/Runner.php:1032
[03-Feb-2019 19:04:30 UTC] PHP 8. require() phar:///usr/local/bin/wp/php/WP_CLI/Runner.php:1105
[03-Feb-2019 19:04:30 UTC] PHP 9. require_wp_db() /app/public/wp-settings.php:106
[03-Feb-2019 19:04:30 UTC] PHP 10. wpdb->__construct() /app/public/wp-includes/load.php:404
[03-Feb-2019 19:04:30 UTC] PHP 11. wpdb->db_connect() /app/public/wp-includes/wp-db.php:592
[03-Feb-2019 19:04:30 UTC] PHP 12. mysqli_real_connect() /app/public/wp-includes/wp-db.php:1531

Does this appear familiar to anyone? Do you know of a fix?

Thanks!
Chris

2 Likes