MySQL No Route to Host, mysqli_connect(): (HY000/2002)
We experienced this error because the ip subnet used by our vagrant environment was the same as the subnet of the database server. We needed to recreate the database server on a different subnet.
Related videos on Youtube

Kenny
I studied Electronic Engineering in Glasgow from 1985, and have worked in electronics ever since. I'm self employed and enjoy work from a number of large and small clients across the UK. More and more of my work also includes firmware, Mac OS and iOS apps, but my firls love is electronics.
Updated on September 16, 2022Comments
-
Kenny about 1 month
I am trying to install BugZilla on Mac OS X 10.9 (Mavericks). I'm hitting a snag with my MySQL configuration.
I have installed MySQL from the DMG Image
mysql-5.6.14-osx10.7-x86_64
MySQL seems to be installed and running ok. I have created a user called bugs, and a database called bugs. I confirm that I can login to MySql from the terminal command line, using the bugs username and password, and access thebugs
database.However the installation of BugZilla fails with an error connecting to MySQL. I tried a simple test and wrote this php file:
<?php // Create connection $con=mysqli_connect(“localhost”,”bugs”,”********”,”bugs”); // Check connection if (mysqli_connect_errno($con)) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } ?>
But it fails at line 3 with:
Warning: mysqli_connect(): (HY000/2002): No route to host in /Users/bugzilla/Sites/test_my.php on line 11 Failed to connect to MySQL: No route to host
Why is it that I can connect from the command line, but not from php?
-
user4035 almost 9 yearsChange the quotes from “ to " when calling mysqli_connect
-
Lelio Faieta@Kenny try using 127.0.0.1 instead of localhost
-