Checkpoints
Check that there is a Cloud SQL instance
/ 20
Check that there is a user database on the Cloud SQL instance
/ 20
Check that the blog instance is authorized to access Cloud SQL
/ 20
Check that wp-config.php points to the Cloud SQL instance
/ 20
Check that the blog still responds to requests
/ 20
Migrate a MySQL Database to Google Cloud SQL: Challenge Lab
GSP306
Overview
In a challenge lab you’re given a scenario and a set of tasks. Instead of following step-by-step instructions, you will use the skills learned from the labs in the course to figure out how to complete the tasks on your own! An automated scoring system (shown on this page) will provide feedback on whether you have completed your tasks correctly.
When you take a challenge lab, you will not be taught new Google Cloud concepts. You are expected to extend your learned skills, like changing default values and reading and researching error messages to fix your own mistakes.
To score 100% you must successfully complete all tasks within the time period!
This lab is recommended for students preparing for the Google Cloud Certified Professional Cloud Architect certification exam. Are you up for the challenge?
Setup
Before you click the Start Lab button
Read these instructions. Labs are timed and you cannot pause them. The timer, which starts when you click Start Lab, shows how long Google Cloud resources will be made available to you.
This hands-on lab lets you do the lab activities yourself in a real cloud environment, not in a simulation or demo environment. It does so by giving you new, temporary credentials that you use to sign in and access Google Cloud for the duration of the lab.
To complete this lab, you need:
- Access to a standard internet browser (Chrome browser recommended).
- Time to complete the lab---remember, once you start, you cannot pause a lab.
Challenge scenario
Your WordPress blog is running on a server that is no longer suitable. As the first part of a complete migration exercise, you are migrating the locally hosted database used by the blog to Cloud SQL.
The existing WordPress installation is installed in the /var/www/html/wordpress
directory in the instance called blog
that is already running in the lab. You can access the blog by opening a web browser and pointing to the external IP address of the blog instance.
The existing database for the blog is provided by MySQL running on the same server. The existing MySQL database is called wordpress
and the user called blogadmin with password Password1*, which provides full access to that database.
Your challenge
- You need to create a new Cloud SQL instance to host the migrated database.
- Once you have created the new database and configured it, you can then create a database dump of the existing database and import it into Cloud SQL.
- When the data has been migrated, you will then reconfigure the blog software to use the migrated database.
For this lab, the WordPress site configuration file is located here: /var/www/html/wordpress/wp-config.php
.
To sum it all up, your challenge is to migrate the database to Cloud SQL and then reconfigure the application so that it no longer relies on the local MySQL database. Good luck!
Tips and tricks
Google Cloud SQL - How-To Guides: The Cloud SQL documentation includes a set of How-to guides that provide guidance on how to create instances and databases, and how to connect applications to those databases.
WordPress Installation and Migration: The WordPress Codex provides information on how to install, configure, and migrate WordPress sites. You will find the instructions on how to create and prepare databases for use with WordPress here.
Task 1. Create a new Cloud SQL instance
In this task, you need to set up a new Cloud SQL instance in Google Cloud. Choose the right configurations and make sure to create the SQL instance in the Zone:
Click Check my progress to verify the objective.
Task 2. Configure the new database
Once you've created the Cloud SQL instance, your next step is to configure the database within it. Set up the necessary database parameters, ensuring it's prepared to receive the existing WordPress database data.
Click Check my progress to verify the objective.
Task 3. Perform a database dump and import the data
Your task here is to perform a dump of the existing wordpress MySQL database and then import this data into your newly created Cloud SQL database. This step is crucial in migrating the database effectively.
Click Check my progress to verify the objective.
Task 4. Reconfigure the WordPress installation
Now that the database has been migrated to Cloud SQL, you need to reconfigure the WordPress software to use this new database. This involves editing the wp-config.php
file in the WordPress directory to point to the Cloud SQL database, moving away from the local MySQL database.
Click Check my progress to verify the objective.
Task 5. Validate and troubleshoot
Your final task is to ensure that the WordPress blog is functioning correctly with the new Cloud SQL database. Check if the blog operates as expected and troubleshoot any issues you encounter. This step is important to confirm the success of your database migration and the overall functionality of the blog.
Click Check my progress to verify the objective.
Congratulations!
You have migrated a MySQL database to Google Cloud SQL. You successfully migrated the database to Cloud SQL and reconfigured the WordPress software to use the new database. You also validated the functionality of the blog and troubleshooted any issues you encountered.
Google Cloud training and certification
...helps you make the most of Google Cloud technologies. Our classes include technical skills and best practices to help you get up to speed quickly and continue your learning journey. We offer fundamental to advanced level training, with on-demand, live, and virtual options to suit your busy schedule. Certifications help you validate and prove your skill and expertise in Google Cloud technologies.
Manual Last Updated May 10, 2024
Lab Last Tested May 10, 2024
Copyright 2024 Google LLC All rights reserved. Google and the Google logo are trademarks of Google LLC. All other company and product names may be trademarks of the respective companies with which they are associated.