Question

Access managed mysql database from Mobile app

Posted October 18, 2019 1.4k views
MySQLDatabases

hi, right now i have a droplet with plesk.
It uses a mysql database and my mobile app use php api to access the database.

Anyway to access the new managed mysql database from my app directly without the droplet. Any api and programming language to run query on the database for my mobile app.

Thanks.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
4 answers

@BinuJohn

I’m afraid I don’t fully understand what you’re asking about.

If you’re asking if your own authored application can connect directly to MySQL;
What language is your Mobile Application written in? It’s likely to have native database connector that you can use to run queries against a DO Managed Database Instance.

BR

andmoo

Thanks for your answer.

If you’re asking if your own authored application can connect directly to MySQL;
Yes.

I am using java, but i dont to hardcode the mysql username and password within the app. i think its not safe.

any other ways?

Binu

There are many techniques to address your concern about hard-coded credentials within the Application code. You might opt to store credentials in a configuration file as seen in applications like WordPress or Django. You may also use Environment Variables to host your credentials or a technique I’ve used in the past is to employ a secrets management engine such as Hashicorp Vault.

The best thing to do is to work out what solution provides the best solution for you. There is a total cost of owner ship increase as the complexity of solution rises.

I hope this helps somewhat.

BR

Andmoo

As far as I know, it is not advisable to access the managed database directly from a mobile app. For instance, if you are distributing the app to a lot of users, later, the login credentials may be leaked.

The best way is to create a web resource( you can use PHP and JSON) to make the API.

Submit an Answer