0

I have a MYSQL server running on my Windows 7 and I need to access it from a Debian VM but when I try I get this error :

ERROR 2003 (HY000): Can't connect to MySQL server on 'xxx.xxx.xxx.xxx' (110)

I checked in my.ini and there is no sign of "bind-address" parameter around so I just can't figure out where the error is.. I can perfectly manage it locally from my Windows. My company is using a proxy but as my VM is on my machine it shouldn't block anything there..

Thanks for your help !

scott_lotus
  • 3,171
  • 22
  • 51
  • 69
Ashenker
  • 1
  • 3
  • Its not just bind-address, it also depends on the mysql user being used which should have access to other ips not just localhost. – Abhik Chakraborty Jan 28 '16 at 09:13
  • I always use root user – Ashenker Jan 28 '16 at 09:17
  • First check ping to windows 7 from VM. – Abhishek Ginani Jan 28 '16 at 09:19
  • it does not matter if its root or any other user, in mysql there is a db called `mysql` which holds db and users info. If you look at the user table there is a col called `host` that will define if the user is allowed to access from outside IP, similarly in `db` table we have the same. Checkout in google how to set them for outside access. – Abhik Chakraborty Jan 28 '16 at 09:21

4 Answers4

0

You need to change user host adress as * or given xxx.xxx.xxx.xxx IP. Look at here: grant remote access of MySQL database from any IP address

Community
  • 1
  • 1
mkysoft
  • 5,392
  • 1
  • 21
  • 30
  • I tried with : GRANT ALL PRIVILEGES ON database.dbname TO 'root'@'192.168.%'; but it didn't solve the problem.. – Ashenker Jan 28 '16 at 09:17
  • You can try manually edit user table in mysql database and flush privilages. – mkysoft Jan 28 '16 at 09:44
  • I could totally do that but what do I want to manually edit in that table ? Everything seems absolutely right to me.. – Ashenker Jan 28 '16 at 09:49
0

You should check that:

  • "bind-address = 0.0.0.0" is present in your my.cnf
  • The user your are using has remote access (not just 'locahost')
  • Check that MySQL port (usually 3306) is opened if you have a firewall running

I would really advice to create a specific user for remote access with limited rights.

Simon
  • 3,580
  • 2
  • 23
  • 24
0

To access MySQL from outside. you should enable MySQL remote access .

1- Comment out following lines in Mysql Config(my.cnf/my.ini(for windows))

#bind-address= 127.0.0.1 (if not exist add it and then comment out)

#skip-networking

2- Save the file and restart Mysql server

3- Update GRANT privilege

By default, mysql username and password you are using is allowed to access mysql-server locally. So need to update privilege.

Run following query to update privilege

GRANT ALL PRIVILEGES ON *.* TO 'USERNAME'@'%' IDENTIFIED BY 'PASSWORD' WITH GRANT OPTION;

Change the 'USERNAME' to your Database user and 'PASSWORD' to User Password

Abhishek Ginani
  • 4,511
  • 4
  • 23
  • 35
  • I now added the 2 commented parameters in my.ini (don't find my.cnf) and restarted the server, I have all the grant options possible for user root but still get the same error.. – Ashenker Jan 28 '16 at 09:31
  • I tried what you and @mkysoft suggested, meaning `GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.%' WITH GRANT OPTION;` and `GRANT ALL PRIVILEGES ON database.dbname TO 'root'@'192.168.%';` – Ashenker Jan 28 '16 at 09:37
  • Try out this :`GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'your_PASSWORD' WITH GRANT OPTION;` Make sure you update the password in query – Abhishek Ginani Jan 28 '16 at 09:58
  • That's pretty much the same as what I just did as I don't have a password for user root..... – Ashenker Jan 28 '16 at 10:03
  • Try to open port 3306 in your windows machine. – Abhishek Ginani Jan 28 '16 at 10:04
  • Well, besides granting privileges and updating config. I'm out of ideas and I have to get going.. good luck! – Abhishek Ginani Jan 28 '16 at 10:17
0

Finally I uninstalled everything and trieed again and it worked so now I close this ticket for good.

Thanks to those who have tried to help me !

Ashenker
  • 1
  • 3