0

actually i am trying to connect MYSQL db which is located in my windows computer. but what i want is, it should be access from any computer from anywhere. (its a requirement for me, because i am writing a java swing desktop application) so , the mysql db should be stored on only one pc, and it should be accessed from any computer with the ip address of the pc in which db is store. i have tried everything, but nothing worked out.

i have asked 2 question on stackoverflow, but no one is answering properly

first question & second question

  1. i tried 3306 port forward in router setting.
  2. inbound and outbound rules have been added.
  3. bind-address property is set to 0.0.0.0 in my.ini file of mysql.
  4. i have assigned reserved ip to my pc in router setting.

added user using create user command.so that it can be accessed from any ip (@%)

  • have granted full permission to that user
  • and then i tried to test mysql connection from

this online connection testing tool

but when i tried it using my ip, user, password and db name it gives me error Can't connect to MySQL server on 'my ip' (13)

so, somewhere i read about ssh... so i was trying it... i tried, hostname=ip of my pc

under tunnels section of SSH... source port=3306 destination=127.0.0.1:3306

but after clicking on open button it gives me error called, Netork error connection refused.

please someone help me. i need to connect my mysql db from any pc from anywhere.

akanksha
  • 11
  • 3
  • Using an ssh tunnel does not really make much sense in my eyes here. If you _really_ want to expose your vulnerable MS-Windows system world wide (I'd say you definitely do _not_ want that, but well...), then port forwarding is what you need. The issue you face also has nothing to do with user permission inside the database management system, this reads like a networking issue. You have to solve that issue. – arkascha Aug 13 '17 at 07:29
  • i have created port forwarding in my router settings – akanksha Aug 13 '17 at 07:30
  • Question: this reads as if you are using a dynamic internet connection at home. If so, how do you configure that connections external address in those application configurations? Since that external address will change with time? – arkascha Aug 13 '17 at 07:30
  • i have given a reserved ip address as well in my router setting – akanksha Aug 13 '17 at 07:31
  • What do you mean here by "reserved ip address"? You need to use your routers _external_ IP address to attempt to connect to it from outside. And that one is dynamic, so will change, unless you have a static IP, which I doubt. – arkascha Aug 13 '17 at 07:32
  • Anyway, that is an issue you have to solve long term, probably using a dynamic DNS provider. For now you should concentrate on getting this to work with the dynamic external IP address. So what happens if you try a connection to that address? `telnet 3306`? – arkascha Aug 13 '17 at 07:33
  • by login to the router setting>> DHCP..address reservation...i have assigned a reserved ip to my machine. – akanksha Aug 13 '17 at 07:34
  • As said before: that is nice and certainly does make sense, but only applies to your _internal_ network topology. Your applications try to connect from the _external_ internet side if I understand your question correctly. So you need to make your connection attempts to your routers _external_ address. – arkascha Aug 13 '17 at 07:35
  • sorry, but will you please explain how can i do it? i am new it.. i havent tried it before... or you can refer any link..so that i can follow it – akanksha Aug 13 '17 at 07:37
  • i didnt understand how to attempt connection to my routers external address – akanksha Aug 13 '17 at 07:37
  • You understand the difference between your internal address and your external address? Your internal addresses (the ones your internal DHCP server gives out and that your MS-Windows system uses) are only "valid" internally, they are not routeable in the internet. So noone can connect to those from the outside, like for example that online testing tool. Everyone outside your local network can only see and access your external IP address, the address your router gets from the DHCP server your internet service provider gives out. _That_ is the address you want to try to connect to. – arkascha Aug 13 '17 at 07:39
  • In addition you need a port forwarding for port 3306 from your router to your local MS-Windows system _and_ you need to open your systems firewall to grant access to port 3306. But as said: then your MS-Windows system is exposed world wide. Something I would not recommend to do... – arkascha Aug 13 '17 at 07:41
  • ok...then how can i try to connect to it??? – akanksha Aug 13 '17 at 07:44
  • yes, i am aware of this security concern... i have added port forward as well as added inbound outbound rules in firewall settings – akanksha Aug 13 '17 at 07:45
  • An easy test is to use the good old `telnet` utility, the suiss army knife of network tests: `telnet 3306`. What happens? You certainly also can use some online test tool or your own application. – arkascha Aug 13 '17 at 07:45
  • A, one more thing: you need to open the port 3306 inbound on both, the router _and_ your MS-Windows system. – arkascha Aug 13 '17 at 07:46
  • you want say that, if my pc wants to commumnicate with the external pc...then because of my router i cant directly do it...because... the router is there inbetween of my pc and any other external pc – akanksha Aug 13 '17 at 07:47
  • This is a very uncommon approach. Fine for a test, but certainly _not_ for production. For that you definitely want to get a virtual appliance from some service provider. – arkascha Aug 13 '17 at 07:47
  • No, that is not what I said. Not talking about your MS-Windows system trying to communicate with anyone at all, not interested in that. The other way round: the external system wants to communicate with your external ip address (your router), that one forwards those requests to your MS-Windows system. All inbound. – arkascha Aug 13 '17 at 07:49
  • i tried connection to my routers extenal ip using online telnet tool...it said..Error #110 (Connection timed out) – akanksha Aug 13 '17 at 07:53
  • Then your port 3306 on the router is _not_ open. Consider that your router _also_ has a firewall, as already mentioned before. – arkascha Aug 13 '17 at 07:56
  • So, any progress here? – arkascha Aug 13 '17 at 15:29
  • No, I think The web hosting for db will be better option for me. SO i m going to looking for some web hosting which offers remote connection – akanksha Aug 14 '17 at 05:54
  • Hmmm, sure, good approach, however you will not find a free web hoster for that. With the typical offers you do get one or several mysql databases, sure. But you will _never_ get a remote connection to those. For that you need to get an own system, a virtual private system, a VPS. There are no free offers for that, but often you get an offer with a domain name included. That makes sense, since you will need to register and use a domain anyway. – arkascha Aug 14 '17 at 19:08
  • thank you.. currently in am going to use freesqldatabase.com as it allows remote connections. and its good for small applications. – akanksha Aug 15 '17 at 03:47
  • Ah, OK. Didnt know that one, so thanks for the info! Good luck and have fünf! – arkascha Aug 15 '17 at 11:43

0 Answers0