Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Ok, I have an install of CentOS 5 running as a GuestOS in VirtualBox. The network card for the Cent box is bridged with that of my host OS so that the boxes can see each other. Cent has an IP of 192.168.1.108 and my Host box has an IP of .104.

Everything, with regard to networking, seems to be working properly as I can access the Drupal install that is on the Cent box from a web browser on my host box by navigating to http://192.168.1.108 however when I try to configure the database for Drupal through the Drupal install interface I am getting the Can't connect to MySQL error.

First I thought this might of been a Firewall issue so I stopped iptables but that had no effect. I thought maybe the user I had setup did not have access to the server so I tried root and that did not work. Searching on the net said that I needed to provide a bind-address parameter to my.cnf so I did that with no change. (As a side note the length of my my.cnf file was MUCH shorter than the ones presented online. In fact under mysqld all I have are datadir, socket, user, and bind-address. Is this normal or should the file be more verbose?)

After a few hours of messing with permissions and such I tried using 'localhost' as the value for the database server, from my HOST OS, and the Drupal install kicked off without a problem. So while my issue is resolved I am curious as to why 'localhost' works and why 192.168.1.108 did not? Is there something i need to do to specifically access the MySQL box via the aforementioned IP?

Thanks.

share|improve this question
add comment

1 Answer

What grant did you issue? MySQL treats connections from localhost different than IP-based connections. Out of the box, you can probably connect as root from localhost w/o a password. Are you using 'root' as your login?

GRANT ALL ON dbname.* from 'user'@'SOURCE' IDENTIFIED BY 'password';

You are using a different user, right? ;-P

share|improve this answer
    
Hehe. Yes. Root is just what I went to when I couldn't connect via the user that I setup but ultimately ran the drupal install with the actual user acct ;]. The user, drupaluser, should be allowed to connect from any host as its host is %. Again, ultimately connecting to the server was not a problem I am just curious as to why I could not hit the server via its IP. Thanks! –  abszero May 21 '10 at 2:35
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.