I'm in the process of setting up a php development environment. My physical machine is running Windows 7 64 bit. I am running the latest version of Virtual box and have setup a new Ubuntu 64 bit guest machine. On the guest I have setup Apache, PHP and MySQL, all three appear to be running okay, apache is running php code fine and php is talking to mysql okay. This VM is running in "bridged adapter" network mode. I can connect to Apache okay from the host Windows machine. I have a hosts file entry in windows pointing a made up hostname to the correct IP address of the guest. That hostname works in the web browser in windows to talk to apache in ubuntu.
What I cannot currently do is talk to mysql in the guest from the host. When I try to connect (currently using sqlyog community edition) it says "error 2003. can't connect to mysql server at ..address..". (I've tried both by hostname and IP for mysql and neither works).
I've checked and mysql is definitely listening on tcp port 3306 on the guest.
Any thoughts what I might be missing?
ETA: I have added a user with the requisite privileges (@'localhost' and @'%') to mysql, and can use that user to connect locally from the ubuntu command line, and from php, but not from the host machine.
connect to mysql on ubuntu guest?
-
noteirak
- Site Moderator
- Posts: 5231
- Joined: 13. Jan 2012, 11:14
- Primary OS: Debian other
- VBox Version: OSE Debian
- Guest OSses: Debian, Win 2k8, Win 7
- Contact:
Re: connect to mysql on ubuntu guest?
This has really nothing to do with Virtualbox, especially if you can already connect to the VM.
Most likely tho, Mysql is only listening on the local ip, but not on your bridged IP. That's the default setup.
If this doesn't solve your issue, you should seek support on a mysql forum.
Most likely tho, Mysql is only listening on the local ip, but not on your bridged IP. That's the default setup.
If this doesn't solve your issue, you should seek support on a mysql forum.
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
Manage your VirtualBox infrastructure the free way!
Re: connect to mysql on ubuntu guest?
Many thanks! So the bridged IP is the 192.168 address that I use to connect to the guest from the host?
-
noteirak
- Site Moderator
- Posts: 5231
- Joined: 13. Jan 2012, 11:14
- Primary OS: Debian other
- VBox Version: OSE Debian
- Guest OSses: Debian, Win 2k8, Win 7
- Contact:
Re: connect to mysql on ubuntu guest?
That should be the one yes
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
Manage your VirtualBox infrastructure the free way!
Re: connect to mysql on ubuntu guest?
Perfect, I worked out how to change the bind address in my.cnf, that's done the job, many thanks for the pointer!