Thursday, May 26, 2016

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



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.


Answer



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


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...