I have Ubuntu running in VMWare. I installed mysql 5 server and comment out bind-address and restarted the mysql server. I am now trying to connect to mysql but i cannot. I tried using 1) Code and 2) A gui app from MySql website. Both report it cannot access the server. What do i need to do to get this to connect?
A number of things could cause this (firewall, other inbound port blocking problems, VMWare NAT'ed without port forwarding, MySQL not listening on the correct interface / MySQL not running networking, incorrect MySQL grant...)
Things to consider:
- Is MySQL running and running with networking (you may need to specify a user/pass for these)?
mysqladmin --protocol=socket ping # check if accessible via UNIX socket mysqladmin --protocol=tcp ping # check if accessible via localhost TCP/IP mysqladmin --protocol=tcp --host=ipaddress ping # check if accessible via external IP (MySQL can be configured to listen on the loopback address only, it can also be configured to *skip-networking* entirely)
- Is the machine accessible from other machines? Run
nmap -sT -p 22,3306 ipaddressfrom another machine, this will give an indication whether the machine is accessible on the SSH/MySQL ports or not.
- If the VM is running in NAT networking mode (as opposed to bridged), then you'll need to ensure the correct ports are forwarded to the machine's real IP address, or otherwise use the NAT address (where accessible) for communicating
- Is a firewall on the VM, or the VM's host preventing access to port 3306 (the default MySQL port)? Check your firewall rules (iptables -L for iptables).
- If you're accessing the MySQL server via DNS, is DNS causing the problem? You can try connecting using the IP address instead of a hostname in this case to eliminate this possibility
- If logins are working on the machine, but permission is being denied remote machines, remember that MySQL performs access control using username, password and hostname (with wildcards permitted). You may need to adjust your grant tables.
I hope one/some these help you track down the problem!
You can also do something like "sudo tcpdump port mysql" on the MySql server box and see if you get any packets when trying to connect from the remote client. That will help narrow down which side of the network the issue is on.