I have a MySQL Server 5.5.32 running on Ubuntu 12.04. Ubuntu is being run on VM. Host platform is Windows 7. How can I connect with the Ubuntu's MySQL from Windows?
I have done the following so far:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;
FLUSH PRIVILEGES;
Running a show grant for root;
displays this:
+-------------------------------------------------------------+
| Grants for root@% |
+-------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION |
+-------------------------------------------------------------+
But when I try to connect to this server from SQLYog running on Windows, I get an error Error 2003 Cannot connect to mysql server on '192.168.xxx.xxx'
.
The IP being feed to SQLYog, I got it from ifconfig
. Supplied the inet addr.
inet addr:192.168.226.xxx Bcast:192.168.226.yyy
Is the address being used is incorrect or are these grant issues? Please advice.
You problem is that (probably) your mysql is bind to 127.0.0.1
instead of 0.0.0.0
.
You should change bind in /etc/mysql/my.cnf
to 0.0.0.0
bind-address = 0.0.0.0
And then restart mysql of course.
In newer versions of MySQL, instead of skip-networking the default is now to listen only on localhost bind-address = 127.0.0.1
So you need to add your machine IP to here or simply comment it out if you are not worry about security concerns.
The error message Error No. 2003: Can't connect to MySQL server on 'localhost' (or some other host)
simply means that connection is not possible for one of the following (or similar) reasons:
There is no MySQL server running at the specified host
Connection to the MySQL server is not allowed using TCP-IP. Check the 'skip-networking' setting in the MySQL configuration file (my.ini on Windows, my.cnf on Unix/Linux). It shall be commented out like '#skip-networking'. If it is not commented out, then do it and restart the MySQL server for the change to take effect. SQLyog needs to connect using TCP-IP.
Some networking issue prevents connection. It could be a network malconfiguration or a firewall issue. We have experienced sometimes that some firewalls is blocking TCP-IP connections even if it claims to be disabled. Most often it will help to uninstall and reinstall the firewall.
When trying to connect to a MySQL server at an ISP this error message often indicates that direct connection to MySQL has been blocked. You must then use HTTP-tunneling or SSH-tunneling to connect.
I think the problem is with the Network Adapter settings in your VM settings
Do like this in your VM settings.
VM Settings -> Network Adapter Settings -> Select Bridged
The VM will connect to the physical network when the network connection is on bridged mode .
Try to ping the VM host in your windows machine after changing the network connection to bridged .
If the VM is pinging in your windows machine then it will work.
Error No. 2003: Can't connect to MySQL server on '192.168.x.x'
simply means that connection is not possible for one of the following (or similar) reasons:
There is no MySQL server running at the specified host
Connection to the MySQL server is not allowed using TCP-IP. Check the 'skip-networking' setting in the MySQL configuration file (my.ini on Windows, my.cnf on Unix/Linux). It shall be commented out like '#skip-networking'. If it is not commented out, then do it and restart the MySQL server for the change to take effect. SQLyog needs to connect using TCP-IP.
Make sure that you are able to connect to MySQL port using telnet
C:\\telnet hostname/IP_address port
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.