Reputation: 119
iam currently working on an android app that stores some user data in some mysql table in a database.Iam planning to host a server in google cloud but i dont even know where to start from,like how to create a database and sql table in mysql,how to connect my android app to the created mysql table in cloud. Any help would be appreciable.I know this is a silly question,but please do help...
i dont have any background codes running for my application,it only has a single sql table and
the users insert and retrieve data to and from the table.
Upvotes: 0
Views: 4826
Reputation: 968
First you should create a Cloud Sql instance and give it a name. Clous Sql gives you an IP address. Then you can either import your database from inside google cloud sql or use MySql Workbench and the given ip to connect to your Cloud sql and import your db using workbench:
1. From Cloud Sql:
First you need to create a bucket and give it a name. Then upload your db into the bucket. Cloud Sql can't import db directly from other directories. then from Cloud sql -> import enter address of your database inside your bucket.
ex: gs://myBucket/mydb.sql
Note: don't forget to put USE XXX (XXX name of your db) inside mydb.sql so that Cloud Sql knows which databse you are talking about.
2. Import using Workbench:
Go to Cloud Sql -> Access Control -> Authorization and add the IP address of your computer that you want to use to connect to the Cloud Sql. Cloud Sql does not allow connections from unknown sources.(Security)
Then from Cloud Sql -> Access Control -> Users you should add your database user name and password (root is default).
You can check your Cloud Sql Ip address from Cloud Sql -> Access Control -> IP Address
Open MySql Workbench and create a new connection. Enter IP address of your Cloud Sql and user name and password for your database and click test connection. Congratulations! now you are connected to Cloud Sql.
Now you can create a new database or import an existing db as usual.
Then go back to Cloud Sql -> Databases and check your imported database.
I hope this helps.
Upvotes: 1
Reputation: 162
I can recommend the udacity course on "Google App Engine":
https://www.udacity.com/course/ud859
It was a great time investment for me!
Upvotes: 0
Reputation: 4870
If you want to start with google cloud infrastructure, and connecting an android app to it, you can check thoses links:
Hope that will help you
Upvotes: 1
Reputation: 315
There is a example for mobile app and backend for google cloud.
Upvotes: 1