Create a MySQL instance on Google Cloud

If you need a database server to manage your data and share with your team, the server needs to be live. Google Cloud offers free $300 for each person for a year. Here are the steps for that.

  1. Create a Google Cloud account: Go to You will need to register for a payment method. As a student, you can use your student card (because it is a VISA card.) Google will deduct a dollar from your card and return it back, therefore you don’t have to pay anything.
  2. Google Console: Once your account is ready, go to Google Console and choose SQL from Storage category.
  3. MySQL or PostgreSQL: At the time I am writing this, PostgreSQL is still beta in Google Cloud, so let’s use MySQL. Now provide details about your database. When the details are completed, click on Create an Instance. Important information includes
    1. hostname must be unique.
    2. root password
    3. zone can just be left as default.
  4. It will take a while to create a VM and related resources (such as storage, network, etc) for you. The console will notify you once it is ready. A MySQL instance has an external IP address which can be used for connecting.
  5. Authorize the Network: By default, the machine cannot be accessed in anyway. You will need to authorize the allowed IP to access your instance. Providing will allow anyone to connect to you. The only security measurement left is the password. Beware.
  6. Test connection: Launch Cloud Shell by clicking the button on the top blue toolbar. The shell is a temporary VM which you can use it to manage several stuff on Google Cloud.

    Now enter this command

    mysql -u root -p -h

    where is your MySQL IP address. You will be prompted for password. Enter the password to get into the instance and try some commands such as, show databases; to confirm that your MySQL is up and running just fine.


Google charges hourly; for a standard MySQL instance costs around $0.30 per hour. Therefore, stop the instance once you don’t use it.

Related Posts

Leave a Reply