Why can't I remotely connect to MySQL running on my Azure VPS?

11,913

Solution 1

You need to have Host specific entries in mysql.user table.

mysql> use mysql;
Database changed
mysql> select Host,User,Password from user;
+------------+------+-------------------------------------------+
| Host       | User | Password                                  |
+------------+------+-------------------------------------------+
| localhost  | root | *62395BB52702DE50773EBF629DD4AE90F07FFD94 |
| sgeorge-mn | root |                                           |
| 127.0.0.1  | root | *62395BB52702DE50773EBF629DD4AE90F07FFD94 |
| ::1        | root |                                           |
| localhost  |      |                                           |
| sgeorge-mn |      |                                           |
| localhost  | suku | *EAF5C8242B88A14545BB61062D64CA5207DD1A37 |
+------------+------+-------------------------------------------+
7 rows in set (0.01 sec)

So, follow me to create such a user with permission for remote access.

[ADDED] If you already have such a user, then try to follow the steps mentioned on me

Solution 2

I hate answering my own question but the solution was right in front of me. I made every logical attempt and finally discovered that it was indeed the Windows Firewall.

I KNEW that obviously blocking the port would prevent it from connecting remotely.

So that was the first place I looked. What I didn't catch, however, is that the inbound rule was set to "Domain". I set it to "Public" and it worked.

Not an expert on Windows Firewall rules but hopefully this will help someone.

Since I will be having an Azure VPS connect to another Azure VPS, it's probably worth mentioning that the firewall rule should be tweaked to only allow connections from the allowed VPS's. But that's a different topic. Hopefully this will help someone else out.

Thanks to @Suku for pointing me to the help page.

Share:
11,913

Related videos on Youtube

cbmeeks
Author by

cbmeeks

Updated on September 18, 2022

Comments

  • cbmeeks
    cbmeeks over 1 year

    I've installed MySQL 5.5 on a Microsoft Azure VPS (2012 Server). I created a user account, told it to allow any host and created an EndPoint on port 3306. I can remote into the VPS using RDP and connect locally just fine.

    I also allowed the MySQL installer to create the needed firewall rules in Windows and it appears to be valid (allowing incoming TCP to port 3306).

    What am I missing?

    The error is "Can't connect to MySQL Server (4) 2003"

    And, I can't seem to find the MySQL log files.

    Also, this is a dump of my mysql.user table:

    Host        User    Password
    -------------------------------------------------------------
    localhost   root    *0735EF2BBDF0D50FB780E9B58198D7260991E311
    127.0.0.1   root    *0735EF2BBDF0D50FB780E9B58198D7260991E311
    ::1         root    *0735EF2BBDF0D50FB780E9B58198D7260991E311
    %           cbmeeks *3CA067E806B5BB2DF87A89D517BBAF80DD22C27A
    

    Neither cbmeeks or root work remotely.

  • cbmeeks
    cbmeeks over 11 years
    Please see my edit above. I already have what you are talking about.
  • Suku
    Suku over 11 years
    Can you try to follow what these people are saying on dev.mysql.com/doc/refman/5.1/en/can-not-connect-to-server.ht‌​ml