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.

On my Windows 7 PC I have Virtual Box running a Centos VM that has PHP installed on it but no MySQL that I brought from the office.

I am trying to set up a database for it. I have Wamp installed on my PC and tried to connect to that database, but I couldn't get it working (I'm thinking since localhost on my PC would not necessarily be visible to the VM). Is there anything I can do to connect to that from a VM or is there a simpler solution to get a MySQL database set up that the VM can connect to?

share|improve this question

closed as off topic by John Gardeniers, Ward, sysadmin1138 Oct 15 '12 at 20:11

Questions on Server Fault are expected to relate to professional server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

    
Can you please elaborate on where you're trying to set-up that database? Is that inside the VM, or on the host OS? WAMP should come with MySQL, so I don't see why you want to jump through hoops. –  tink Oct 15 '12 at 4:16
    
Wamp is on the host OS (VM is linux which i am very unfamiliar with). –  Damon Oct 15 '12 at 4:25
    
I posted this here because I put it on SO and was told it belonged here. Really dislike it when a question gets closed with no comments. –  Damon Oct 16 '12 at 1:07
add comment

1 Answer

To install MySQL and other needed packages on CentOS (doesn't matter if it's a VM or physical), all you have to do is run

sudo yum install mysql-server php-mysql

This will install MySQL server and a php library to talk to it and any missing dependencies for it.

share|improve this answer
    
noice. i kind of want to keep mysql separate from the VM .. is there an easy way to do that? –  Damon Oct 15 '12 at 5:22
    
If you still want to keep MySQL on your host machine, then 1st you need to make sure that your VM is allowed to communicate over network with your host. Next you need to make sure that your MySQL/WAMP is configured to listen on your LAN IP and not just on 'localhost'. –  Mxx Oct 15 '12 at 5:25
add comment

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