开发者

How to access db in vps

开发者 https://www.devze.com 2023-03-01 14:35 出处:网络
Hi in order to a开发者_如何学运维ccess the db on my vps i have to previosly connect via ssh I have tested this with MySQL WORKBENCH and it works.

Hi in order to a开发者_如何学运维ccess the db on my vps i have to previosly connect via ssh I have tested this with MySQL WORKBENCH and it works. But Netbeans (working ide) does no provide ssh connection when creating a db connection so I cannot connect my local application to my new server. How can I go around this? How can i set my jta datasource to deal with this?

Thank you very much Best Regards Ignacio


There are two ways to archive connectivity from netbeans:

  1. REALLY UNSAFE Method: Make MySql listen on the network-interface connected to the internet. Set bind-address in your mysql-configuration file to 0.0.0.0 and mysql will listen on all interfaces. http://dev.mysql.com/doc/refman/5.6/en/server-options.html#option_mysqld_bind-address You can then access MySql from everywhere on the internet.
    Remember: This is a serious security vulnerability! Search Google and you will find a lot of articles explaining in great detail why.

  2. Safe method: SSH can do port-forwarding. It means, that one port on your local machine listens for connections and tunnels all traffic well encrypted to the remote port. On linux this is done with ssh -L 3306:localhost:3306 YOUR_SERVERS_IP. You can then access your MySql-Server on localhost:3306 like it is running on your local computer (just slower). On Windows Putty can be configured to do the same thing. I don't remember exactly where, but in the dialog where you setup your connection (before the command-prompt) you also can configure port-forwarding.

  3. Write an application to run on your server, which takes care of Authorization and exposes and API to users (like the Youtube-api for example, which has some public methods but also some requiring authentication). This could be done in numerous different ways like XMLRPC (using a webserver and some web-application) or a custom protocol. This is probably the one most suitable for production use.


Poke some holes in your firewall to let NetBeans connect?

I would recommend you simply copy the database to your development environment and don't touch the VPS unless you're ready to 'release'.

0

精彩评论

暂无评论...
验证码 换一张
取 消