How do I migrate MYSQL Paas Database to a Virtual Machine on Azure ?

Ankit Negi 0 Reputation points
2023-04-13T09:49:20.44+00:00

How do I migrate MYSQL Paas Database to a Virtual Machine on Azure ?

Azure Database Migration service
Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,874 questions
Azure Database for MySQL
Azure Database for MySQL
An Azure managed MySQL database service for app development and deployment.
824 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Andriy Bilous 11,421 Reputation points MVP
    2023-04-13T12:07:53.98+00:00

    Hello @Ankit Negi

    To migrate a MySQL PaaS Database to a Virtual Machine on Azure, you can follow these steps:

    1. Set up the target MySQL server:
      • Provision a new Azure Virtual Machine (VM) with your desired OS (e.g., Ubuntu, CentOS).
      • Install the MySQL server on the VM. Follow the official MySQL installation guide for your chosen OS.
    2. Prepare the source PaaS MySQL database for migration:
      • Enable binary logging (if not enabled) on the source PaaS MySQL database, as it's required for the migration process.
      • Create a dump of the source MySQL database using a tool like mysqldump. For example:
      • mysqldump -u <username> -p --databases <database_name> --single-transaction --set-gtid-purged=OFF --triggers --routines --events --hex-blob --default-character-set=utf8mb4 --order-by-primary -r <output_file.sql>
      • Replace <username>, <database_name>, and <output_file.sql> with appropriate values.
    3. Transfer the database dump to the target VM:
      • Use a tool like scp, rsync, or Azure Storage to transfer the database dump file to the target VM.
    4. Restore the database on the target VM:
      • On the target VM, execute the following command to restore the database from the dump:
      • mysql -u <username> -p < <output_file.sql>
      • Replace <username> and <output_file.sql> with appropriate values
    5. Verify the data migration:
      • Perform some tests to ensure that the data has been successfully migrated and that the new MySQL server on the VM is functioning as expected.
    6. Update application configurations:
      • Update the database connection settings in your applications to point to the new MySQL server running on the VM.
      1. (Optional) Set up replication:
      • If you want to minimize downtime during the migration process, you can set up replication between the source PaaS MySQL database and the target MySQL server on the VM. You can follow the official MySQL replication documentation to set up replication.

    Once you've completed these steps and verified that everything is working as expected, you can decommission the source PaaS MySQL database. Be sure to monitor the new MySQL server on the VM for performance and adjust the VM resources as needed

    0 comments No comments

  2. Oury Ba-MSFT 19,101 Reputation points Microsoft Employee
    2023-05-08T19:41:38.27+00:00

    Ankit Negi Thank you for reaching out.

    My understanding is that you want to migrate a MYSQL DB PaaS to a virtual machine in Azure.

    Adding on top of Andriy Bilous's answer. Please follow instructions in the following doc to achieve that.

    https://video2.skills-academy.com/en-us/sql/sql-server/migrate/guides/mysql-to-sql-server?view=sql-server-ver16

    Please let us know if that helps.

    Don't forget to mark as accept answer wherever information provided were helpful.

    Regards,

    Oury


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.