MySQL To AlloyDB: The Ultimate Guide

Luke Smith
Enterprise Solutions Architect
August 28, 2023
Matt Tanner
Developer Relations Lead
August 28, 2023
Matt Tanner
Developer Relations Lead
August 28, 2023
Get a migration case study in your inbox
Join our newsletter


Data management has become a cornerstone for the successful operation of businesses worldwide. As industries evolve and new technologies emerge, the shift from traditional database systems to advanced ones is rapidly accelerating. In this blog, we will take a deep dive into two such database systems, MySQL and AlloyDB, and learn about their key features. Additionally, we will discuss the process of migrating data from MySQL to Google AlloyDB using two different methods and highlight the potential challenges and advantages associated with these approaches. The first method will include using Arcion to build a scalable, real-time data pipeline for seamless migration and replication. The second method will include a manual, more time-consuming approach using native tools built into each platform. Let’s start by looking at both the MySQL and AlloyDB platforms.

Table of Contents

Introduction to MySQL 

MySQL is one of the most popular open-source Relational Database Management Systems (RDMS) in existence. The platform runs on a client-server model and has numerous features that are ideal for both small and large applications. Since MySQL is open-source, anyone can download the software and modify the source code to meet their business needs. 

MySQL’s popularity is driven by its high performance, reliability, and the fact that it is very easy to use and deploy. Due to its ease of use, it became a staple in one of the most popular web app stacks used across the internet: the LAMP stack. It is compatible with many computing platforms such as Microsoft Windows, macOS, Linux, and Ubuntu and supports connectivity through languages like PHP, Python, Java/JDBC, C++, C, ODBC, Perl, and Ruby. It also supports open-source applications like Drupal, Joomla, Magento, and other popular CMS platforms, with the most popular CMS use case being WordPress. Battle-tested as one of the most popular database solutions for many of the world’s largest web applications, it has become a go-to for big organizations such as Facebook, Twitter, Netflix, Uber, and others with large volumes of data and users accessing their applications.

MySQL also has variations such as MySQL Heatwave, a fully managed service that enables customers to run OLTP, OLAP, and machine learning workloads directly from a MySQL Database. Also available is MySQL Enterprise Edition, with its complete set of advanced features, management tools, and technical support. Others include MySQL for OEM/ISV, and MySQL Cluster CGE used for web, cloud, and communications services.

Key Features of MySQL

  • Open-source: MySQL is free and open-source; therefore, it can be modified through its source code to handle your basic requirements.
  • Client/Server Architecture: MySQL is based on a client-server model where the database server (MySQL) can communicate with many clients (multiple applications and programs) to query and make changes.
  • Scalable: MySQL is developed to scale easily to meet your business needs, be it a small or large amount of data, clusters of machines, etc. It can handle almost any amount of data.
  • Character Sets: MySQL supports different character sets such as Latin 1 (cp 1252 character encoding), German, Unicode characters, and so on.
  • Data Types: MySQL contains multiple data types such as unsigned integers, signed integers, text, date, time, datetime, timestamp, blob, FLOAT, DOUBLE, character (CHAR), variable character (VARCHAR), and so on.
  • Large Databases: MySQL supports large databases of up to about 40 to 50 million records, 150,000 to 200,000 tables, and up to 5,000,000,000 rows.
  • Client and Utility Programs: MySQL contains many client and utility programs such as mysqladmin, MySQL Workbench, etc. 
  • Compatible With Many Operating Systems: MySQL runs on many operating systems like Microsoft Windows, macOS, Linux, varieties of UNIX, Nivell Netwave, and many more. 
  • MySQL Community: MySQL has a devoted community of developers that one can access to tackle issues and troubleshoot.

Introduction to AlloyDB

AlloyDB is an innovative addition to the realm of databases, developed specifically to address the needs of today's data-rich applications. As a distributed SQL database system written on top of PostgreSQL and engineered by the team at Google Cloud, it features a unique blend of high performance, scalability, and strong consistency. These traits set it apart from many other database systems and solutions today.

One of the key strengths of AlloyDB lies in its architectural design. It deploys a distributed data model, intelligently spreading information across multiple servers. This architecture dramatically enhances its data handling capacity, making it an excellent option for businesses with immense data volumes and high transaction loads. In contrast to traditional Relational Database Management Systems (RDBMS) that can often struggle with scale, AlloyDB excels. It gracefully accommodates scaling out, automatically adding more machines or nodes to a system to manage the increased load. 

AlloyDB also maintains a firm commitment to strong consistency. This means AlloyDB does not compromise consistency for scalability and ensures that all clients always have the most current view of the data. This feature is particularly vital in business applications where maintaining data integrity and consistency across multiple transactions is paramount. AlloyDB combines its distributed, scalable architecture with the familiarity and flexibility of PostgreSQL. This fusion allows businesses to harness the power of their existing SQL and Postgres knowledge and skills while reaping the benefits of next-generation distributed database technology.

Key Features of AlloyDB

  • Scalability: AlloyDB is designed to scale horizontally, which means as your data grows, you can simply add more nodes to the network to increase capacity.
  • Consistency: Despite its distributed nature, AlloyDB provides strong consistency, ensuring data integrity across all nodes.
  • Fault Tolerance: AlloyDB has built-in mechanisms to recover from hardware or network failures, making it highly reliable regarding data safety and accessibility.
  • Concurrent Transactions: AlloyDB can handle many concurrent transactions, thus ensuring high performance even under heavy loads.
  • Global Transactions: AlloyDB supports distributed transactions across multiple nodes, allowing for complex, real-world workflows to be modeled easily.

How To Migrate Data From MySQL To AlloyDB

Migrating data from one database system to another can be a challenging process, particularly when dealing with large volumes of data and different database architectures. The exact method you use to migrate the data will heavily depend on data volume and the complexity of the data. In this next part, we'll look at two different migration methods from MySQL to AlloyDB. First, using Arcion, a specialized tool that helps organizations easily migrate and replicate data regardless of volume or complexity. Lastly, we will look at manually migrating data between the platforms via custom code and scripts that leverage native technologies.

Method 1: MySQL to AlloyDB using Arcion

Arcion is the leading real-time, in-memory Change Data Capture (CDC) solutions that offer users massive scalability and data consistency. It is suitable for both migrating and replicating data across various enterprise databases and data warehouses. This section will look at how to connect MySQL to AlloyDB using the Arcion UI. This can be done in Arcion Cloud or Arcion Self-Hosted. The following functionality is also available via CLI, although this blog does not cover it.

Create a New Replication

First, we must log into Arcion to set up our replication pipeline to enable CDC. For Arcion Cloud, you can sign up and login here.

Next, we will select our replication mode and write mode. A few options are available to suit your needs. For replication modes, Arcion supports:

  • Snapshot (the initial load) 
  • Realtime (CDC)
  • Full (snapshot + CDC)

For write modes, Arcion supports:

  • Replacing
  • Truncating
  • Appending

We will select the Replication mode as Full and the Write mode as Truncating. You will also see that I have named the replication “MySQL to AlloyDB.”

Once the Name is populated and the Replication and Write Modes are selected, click Next at the bottom of the screen.

Configure the Source MySQL Connector

We are then brought to the Source screen. From here, we will click the Add your own source button.

We then will select MySQL as our source, and then, scroll to the bottom of the page, and click Continue.

Now, we can add our MySQL instance details. These details include:

  • Connection Name
  • Host
  • Port
  • Username
  • Password

All other fields will default. For Username and Password, you will need to ensure that the user has the correct permissions in MySQL to ensure it can read the necessary data.

With our data source correctly configured, we will click the Test Connection button to ensure everything works as expected.

The results should look like this once the test is finished running. Finally, you can click the Done button to exit.

Once the connection is saved and tested, click Continue. Next, we will want to pull in the schema from the database. Arcion will prompt us to click the Sync Connector button on the next page. Click the button, and Arcion will connect to our MySQL instance and pull down the schema. Once completed, the UI in Arcion will display the retrieved schema. Then we will click Continue in the bottom right corner of the screen to move to the next step.

With our sync successful, we can now click Continue to Destination in the bottom right corner of the screen to move to the steps where we set up our destination.

Configure the Destination AlloyDB Connector

On the Destination screen, we will click Add your own destination to start the setup of our AlloyDB connector.

Then, select AlloyDB as your Connection Type and click Continue.

On the next screen, input your connection details. These details include:

  • Connection Name
  • Host
  • Port
  • Username
  • Password

All other fields will default. For username and password, we will require a user that can connect and write to our AlloyDB instance.

Once you put in all the details and click Test connection, you’ll see that the AlloyDB connector can connect to the target database.

Now, after clicking Done on the connection test, we can click Continue to Filter to begin the Filter configuration for our pipeline. 

On the Filters screen, we will check the Select All checkbox to replicate all of our tables and columns from the source to the destination.

You can also click on the Map Tables and Per Table Configs (Applier Configuration Docs, Extractor Configuration Docs) buttons to add further configuration. For our purposes, we will leave these as their default values. After clicking Save to save the filter, click Start Replication.

Once the initial data is loaded, the pipeline will continue to run, monitor for changes, and apply those changes to the destination. The idle pipeline will still show RUNNING in the top right of the screen but will show a row replication rate of 0 until new data is written to the source. You’ll also notice that the Phase description of the pipeline will now show Change Data Capture instead of Loading Snapshot Data.

Since we are using Full-mode replication, If we start adding data to the MySQL instance, we will see that Arcion detects this and then syncs that data to AlloyDB in real-time.

Of course, we don’t require CDC to be enabled to handle the initial migration, we could just use the Snapshot mode. An advantage of enabling CDC during the migration is that CDC can make migrations easier by allowing for zero downtime migrations. The old and new databases can stay in sync until all applications and services using the old database are moved to use the new AlloyDB instance.

Advantages of Using Arcion

Below are some highlights and advantages of using Arcion for data migrations and Change Data Capture between MySQL and AlloyDB.

Sub-Second Latency 

Many other existing CDC solutions don’t scale for high-volume, high-velocity data, resulting in slow pipelines and delivery to the target systems. Arcion is the only distributed, end-to-end multi-threaded CDC solution that auto-scales vertically & horizontally. Any process that runs on Source & Target is parallelized using patent-pending techniques to achieve maximum throughput. There isn’t a single step within the pipeline that is single-threaded. It means Arcion users get ultra-low latency CDC replication and can keep up with the ever-increasing data volume on Source.

100% Agentless Change Data Capture

Arcion is the only CDC vendor that offers 100% agentless CDC to all its supported enterprise connectors. The agentless CDC applies to all complex enterprise databases, including MySQL and AlloyDB. Arcion reads directly from the database transaction log, never from the database itself. Previously, data teams faced administrative nightmares and security risks associated with running agent-based software in production environments. You can now replicate data in real-time, at scale, with guaranteed delivery — but without the inherent performance issues or the security concerns.

Data Consistency Guaranteed

Arcion provides transactional integrity and data consistency through its CDC technology. To further this effort, Arcion also has built-in data validation support that works automatically and efficiently to maintain data integrity. It offers a solution for scalable data migration and replication while ensuring zero data loss has occurred.

Automatic Schema Conversion & Schema Evolution Support

Arcion handles schema changes out of the box, requiring no user intervention. This helps mitigate data loss and eliminate downtime caused by pipeline-breaking schema changes by intercepting changes in the source database and propagating them while ensuring compatibility with the target's schema evolution. Other solutions would reload (re-do the snapshot) the data when there is a schema change in the source databases, which causes pipeline downtime and requires a lot of compute resources, which can get expensive!  

Method 2: MySQL to AlloyDB Manually

In certain circumstances, users may want to implement a more manual approach to data migration. Although tough to do at scale, it can be a viable option for smaller migration efforts. This section will provide a more detailed guide on one way to perform manual data migration from MySQL to an AlloyDB database. Of course, other methods could also be used that are not covered in this section as well.

Step 1: Export the Data from MySQL into CSV Files

First, you need to export your MySQL data into CSV files. You can use the `SELECT INTO OUTFILE` SQL statement. Here is a basic example:

SELECT * INTO OUTFILE '/path/to/yourfile.csv'
FROM your_table;

Replace `/path/to/yourfile.csv` with the path where you want the CSV file to be stored, and replace `your_table` with the name of the table you want to export. Run this command for every table you want to export.

Step 2: Modify the Data to Match AlloyDB's Schema

Once you have the CSV files created for the relevant tables, inspect the data and the schema of your AlloyDB. The data structure of MySQL might not match exactly with AlloyDB. For example, you might need to change the data types, structure, or format.

A common example is assuming that MySQL has a date field in the format 'YYYY-MM-DD', but AlloyDB requires it in the format 'DD-MM-YYYY'. You could use a scripting language to create a simple batch program to convert to the needed format. Below is an example of how this could be done in Python.

import csv
import datetime

with open('infile.csv', 'r') as f, open('outfile.csv', 'w') as g:
    reader = csv.reader(f)
    writer = csv.writer(g)
    for row in reader:
        row[1] = datetime.datetime.strptime(row[1], '%Y-%m-%d').strftime('%d-%m-%Y')

This script reads the date from 'infile.csv', equivalent to one of your table CSV files, changes the date format, and writes the modified data to 'outfile.csv'. This stage could be fairly simple or quite complex, depending on what transformations need to happen.

Step 3: Import the CSV Files into AlloyDB

After modifying your data, you can import it into AlloyDB. For this part, you’ll need to execute a few steps:

  1. Upload the CSV file to a Cloud Storage bucket.
  2. Prepare a client host to perform the import operation.
  3. Import the CSV file into the database.
  4. Clean up the resources created to perform the procedure.

Once these steps are complete, your data will be available in AlloyDB. For exact instructions, check out the AlloyDB docs on how to import a CSV file.

Limitations and Challenges of Using Custom Code Method

Although a custom code approach is possible and may be useful in smaller migration operations, it has some significant drawbacks. Below are a few limitations and challenges of using custom code and scripts to migrate data from MySQL to AlloyDB.

  • Technical Expertise Required: Writing custom scripts requires a strong understanding of MySQL and AlloyDB and proficiency in a scripting language like Python or Perl.
  • Time-Consuming: Developing, testing, and executing custom scripts can be a lengthy process, especially when dealing with large databases.
  • Risk of Data Loss: Without proper data validation, there is a risk of data loss or corruption during the migration process.
  • Lack of Support: You won't have access to technical support when using custom scripts, as you would with a dedicated migration tool like Arcion.


Database migration is a complex but often necessary process as businesses evolve and their data requirements change. While both MySQL and AlloyDB have their unique advantages, the choice between them should be made based on the specific needs of your business.

For a no-code migration solution that works seamlessly with MySQL and AlloyDB, try out Arcion and have a scalable and reliable CDC-enabled pipeline set up in minutes. Available in two different deployment types, if you’re looking for a flexible on-premise solution, try Arcion Self-Managed. Using a  fully-managed approach, try out Arcion Cloud for our easiest option. Regardless of the deployment type chosen, Arcion provides unparalleled flexibility and scalability for data pipelines using MySQL as a data source and AlloyDB as the target destination for the data.

Interested to learn more? Schedule a personalized demo with our database expert today.

Matt is a developer at heart with a passion for data, software architecture, and writing technical content. In the past, Matt worked at some of the largest finance and insurance companies in Canada before pivoting to working for fast-growing startups.
Matt is a developer at heart with a passion for data, software architecture, and writing technical content. In the past, Matt worked at some of the largest finance and insurance companies in Canada before pivoting to working for fast-growing startups.
Luke has two decades of experience working with database technologies and has worked for companies like Oracle, AWS, and MariaDB. He is experienced in C++, Python, and JavaScript. He now works at Arcion as an Enterprise Solutions Architect to help companies simplify their data replication process.
Join our newsletter

Take Arcion for a Spin

Deploy the only cloud-native data replication platform you’ll ever need. Get real-time, high-performance data pipelines today.

Free download

8 sources & 6 targets

Pre-configured enterprise instance

Available in four US AWS regions

Contact us

20+ enterprise source and target connectors

Deploy on-prem or VPC

Satisfy security requirements