[SOLVED] How to access external MySQL from within Vagrant?


I would like to access a MySQL database in the public network my host is on.
I need to access the MySQL database from within Vagrant by connecting to the DB via PHP’s mysql_connect.

I have an ubuntu/trusty64 Vagrant box running Apache2, PHP and MySQL through the old mysql extension.

When I try to connect to the database on the network via the DB server’s IP address, it says Can’t connect to database.

What do I need to do to be able to access external servers from within the Vagrant guest?


I could connect properly after all. I just mixed up the variables for my password and the DB name in my code. ^_^;

Answered By – rakista112

Answer Checked By – Katrina (BugsFixing Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *