Connect Google Cloud SQL with MySQL Workbench

This post will show you how to create a Google Cloud SQL instance and connect your Google Cloud SQL instance database with MySQL Workbench. Before connecting, make sure you have enabled billing for Google Cloud Engine.

Creating a Google Cloud SQL instance

  1. Go to the Google Cloud Console.
  2. Create a new Cloud Console project, or open an existing project.
  3. In the sidebar on the left, select Cloud SQL to open the Cloud SQL control panel for the project.
  4. Click New Instance to create a new Cloud SQL instance in your project.
  5. Enter a name for the instance. The instance name will be automatically combined with your project name, and any domain-specific names as shown here:
    • Non-domain: your-project-name:your-instance-name
    • Domain-specific: your-domain:your-project-name:your-instance-name
  6. In-order to use Google Cloud SQL with external applications, you need to Authorized IP Addresses of those external applications. To do that in Assign IP Address section
    • Select Assign IP Address radio button.
    • Enter your applications IP address in “Authorized IP Addresses” box. (In this scenario it’s your PCs IP address. You can find this by googling “what is my ip”  )
  7. Click Confirm to create the instance.

Connecting with MySQL Workbench

  1. In the MySQL Workbench home view, click New Connection.
  2. In the Setup New Connection window, provide a Connection Name, Hostname, Username, and Default Schema, if applicable, as shown below
    The Setup New Connection, Advanced in MySQL Workbench. 
  3. Click Test Connection. You will be prompted for a password.
  4. Optionally, click Advanced, and fill in the information for connecting with SSL as shown in Figure 2. Be sure to select Use SSL if available and specify a SSL CA File, a SSL CERT File, and a SSL key File.
    mysql-workbench-02 
  5. Click Test Connection to make sure all the advanced parameters are okay.
  6. Click Close.
  7. Connect with the connection you just created.

That’s it 🙂 Now you can use MySQL workbench to manage your Google Cloud SQL instance.

  • Angela

    I keep getting the “Failed to Connect to MySQL at [IP address] with user [username]. Access denied for user ‘username’@ipaddress’ (using password: YES)”. I’m putting the IP address I got from the Cloud SQL > Access Control. I left the port as 3306. The username, I left as “root”. Password, I put in my password that I setup in the Access Control. Not sure what else I’m missing or doing wrong.

    • In the cloudsql dashboard you might actually want to set a password. It starts without a password, so trying to connect might not work.