简体   繁体   中英

API to connect to my MySQL Database Remotely

apparently my hosting provider does not support Remote MySQL Usage as it says in its Knowledge Base even though i bought a premium package

remote MySQL connections are disabled for security and performance reasons. You can only connect to MySQL from your PHP scripts hosted on our servers.

is there any way i can make an API so that i can connect to my MySQL Remotely ?. i need to use the Database in my Host Account as a source of information for my Android Application. thanks

You should look into using something like a HTTP Tunnel .

This post outlines a method of doing this for Android.

Basically you connect through this tunnel which is placed on your server, and can the communicate with the server as if you were localhost .

SSH is also another option, although you'll need remote SSH access enabled by your host. That's normally something you'll have to specifically request for them to enable.

You would then create an SSH tunnel using a technique like this and then use that as your connection for your database. Once you've initiated the connection you would then query it as normal.

There are possibilities here.

  1. Your hosting provider may have allowed access of the database only on certain IP(s) on certain PORTS. In this case, you cannot access the database even if you write API's because the connection is not open to the IP/PORT through which you are accessing through.

  2. The database admin can also block access to certain table(s) or database(s) for certain users.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM