How to connect to my MySQL server on my VPS from my computer?

JoshuaLuke

Posting Freak
Jan 29, 2012
529
51
Hiya guis,

I have my MySQL server on my VPS but i'm wanting to connect to it from my local computer via Navicat but how do I do this? I tried inputting the IP instead of 127.0.0.1 but it couldn't connect

Thanks
Josh
 

Heaplink

Developer & Designer
Nov 9, 2011
510
173
Follow these steps:
Normally you should NEVER, and I mean NEVER forward port 3306 - but since you really want remote connection, you'll have to open this for incoming and outgoing connections as said. Then you need to set up MySQL to allow connections from a remote user and make a remote user (%) with a password.

Good luck.
 

JoshuaLuke

Posting Freak
Jan 29, 2012
529
51
Follow these steps:
Normally you should NEVER, and I mean NEVER forward port 3306 - but since you really want remote connection, you'll have to open this for incoming and outgoing connections as said. Then you need to set up MySQL to allow connections from a remote user and make a remote user (%) with a password.

Good luck.

Why should I NEVER open port 3306? Any reason? :S
 

Heaplink

Developer & Designer
Nov 9, 2011
510
173
Because of security. Any time you open a port (depends how, but mostly) it will be open to both ways, incoming (client to server) and outgoing (server to client). This means people can go through that port and have a connection to that software that uses that port. And since MySQL is software and uses 3306 for this, it is a security risk.

Normally only use SSH (if you got Linux or Windows with PuTTy) it's the most recommended way.
 

JoshuaLuke

Posting Freak
Jan 29, 2012
529
51
Because of security. Any time you open a port (depends how, but mostly) it will be open to both ways, incoming (client to server) and outgoing (server to client). This means people can go through that port and have a connection to that software that uses that port. And since MySQL is software and uses 3306 for this, it is a security risk.

Normally only use SSH (if you got Linux or Windows with PuTTy) it's the most recommended way.

I opened port 3306, and it worked but should I just access MySQL via the server or is it just a minor security threat?
 

Heaplink

Developer & Designer
Nov 9, 2011
510
173
It's is not a minor but a major security threat, since everyone have access to your server through mysql, and your database contain information, that you can modify, delete, add or worse. Therefore, if you're going to open the port, make sure your username for mysql is not default (root) and is a secret and the same with your password, make it hard to get to.
 

Users who are viewing this thread

Top