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
- Go to the Google Cloud Console.
- Create a new Cloud Console project, or open an existing project.
- In the sidebar on the left, select Cloud SQL to open the Cloud SQL control panel for the project.
- Click New Instance to create a new Cloud SQL instance in your project.
- 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:
- 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” )
- Click Confirm to create the instance.
Connecting with MySQL Workbench
- In the MySQL Workbench home view, click New Connection.
- In the Setup New Connection window, provide a Connection Name, Hostname, Username, and Default Schema, if applicable, as shown below
- Click Test Connection. You will be prompted for a password.
- 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.
- Click Test Connection to make sure all the advanced parameters are okay.
- Click Close.
- Connect with the connection you just created.
That’s it 🙂 Now you can use MySQL workbench to manage your Google Cloud SQL instance.