Menu
×
   ❮     
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS R TYPESCRIPT ANGULAR GIT POSTGRESQL MONGODB ASP AI GO KOTLIN SASS VUE DSA GEN AI SCIPY AWS CYBERSECURITY DATA SCIENCE
     ❯   

AppML using Google Cloud SQL


Google Cloud Services

Google Cloud SQL is a database cloud service.

It is easy to set up and manage.

It is FREE to try!

What is Google Cloud SQL

Google Cloud SQL is a cloud based database service.


Why use Google Cloud SQL?

Google Cloud SQL offers MySQL databases deployed in the cloud without a fuss.

Google offers powerful databases that run fast, and flexible charging (pay per use).

Google manages automated backups, patching, and recovery.


Getting Started

Before you can start using Google Cloud SQL, you need a Google account, and sign up for Google Developers Console.

If you do not have a Google account you can sign up for one here: Create your Google Account


Sign Up for Google Developers Console

When you sign up for Google Developers Console, your Google account is automatically signed up for all services in Google Cloud, including SQL.

If you are a new Cloud Platform user, you can get started with a trial period for free.

The Cloud Platform free trial allows you to try Cloud SQL for free for 60 days. For more information, see Cloud Platform Free Trial.

If you decide to continue with Cloud Platform after your free period (or if you need more storage or performance than the free usage tier offers), you only pay for the resources you use.

To create an Google Developers Console account go to: https://console.developers.google.com/freetrial, and follow the on-screen instructions.


Create a MySQL Database Instance

In this example we will set up a Database instance running MySQL.

 Create a MySQL DB instance:

  • Once you have created your account Google will automatically create a new project for you called "My First Project". In this example we will just use that project.
  • In the menu, click "Storage", and then "Cloud SQL"
  • Click "Create an instance"
  • On the "Create Cloud SQL instance" page select a name, region and performance tier for your DB instance. In this example we will skip the advanced options.
  • Click "Create"
  • The new DB instance appears in the list of DB instances (when it has the status "Runnable" it is ready for use)
  • Click on the name of the instance, and click "Access Control" on the navigation pane
  • Click "IP address" in the sub-navigation pane, and click the "Request IPv4 address" button
  • Keep this IP address, as it will be the IP address you use to connect to your database
  • Click "Users" in the sub-navigation pane, and click the "New user" button
  • Specify a username and password for your database
  • Click "Authorization" in the sub-navigation pane, and click the "+ Add item" button under Allowed Networks
  • Here you can specify who has access to your database, It can be:
    • Your own IP, or the IP of your server. This way only you have access to your database
    • or 0.0.0.0/0, which allows all external IP addresses to connect (this can be a security risk, and cause extra costs)
  • Click "Save"
  • Click "Databases" in the navigation pane, and click the "New database" button
  • Specify a name for your database (you can leave the other options as they are unless you have specific requirements)

Now you have a Google Cloud SQL database, with an IP that you can connect to.



Configure Database Connection in AppML

To configure the database connection, edit the appml_config file:

PHP example: appml_config.php

<?php echo("Access Forbidden");exit();?>
{
"dateformat" : "yyyy-mm-dd",
"databases" : [{
"connection" : "mydatabase",
"host" : "yourDatabaseURL",
"dbname" : "yourDatabaseName",
"username" : "yourUserName",
"password" : "yourPassword"
}]
}

Edit the following:

  1. mydatabase - change to whatever you want the database connection to be called in your application
  2. yourDatabaseURL - change to the IP from the previous step, and add the port 3306 (like this 192.168.1.1:3306)
  3. yourDatabaseName - change to the name of your database instance in Google Cloud SQL
  4. yourUserName - change to the username you specified for your database in Google Cloud SQL
  5. yourPassword - change to the password you specified for your database in Google Cloud SQL

AppML should now be configured to connect to your Google Cloud SQL database.

You can now fill your database with data:

×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
sales@w3schools.com

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
help@w3schools.com

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookie and privacy policy.

Copyright 1999-2024 by Refsnes Data. All Rights Reserved. W3Schools is Powered by W3.CSS.