How to migrate MySQL database single server to flexible server?

Riddhi Jadeja 40 Reputation points
2023-07-05T15:32:24.32+00:00

I have two MySQL single server instances for my Azure Subscription one is for Test and another for Production. For production DB Azure is providing automatic migration from single server to flexible server. I have two main concerns here:

  1. What about the test DB I have, do I need to migrate manually as they gonna migrate only the Production DB.
  2. Connection string changes from single server to flexible server as follows (Specially with userid & ssmode), so do we need to change our source code & re-deploy everything or it will be automatically handled:
    1. Flexible server: Server="{server_url}";UserID = "{someuser}";Password="{your_password}";Database="{your_database}";SslMode=Required;SslCa="{path_to_CA_cert}";
      1. Single server: Server={server_url}; Port=3306; Database={your_database}; Uid={someuser}@{host}; Pwd={your_password}; SslMode=Preferred;

Can anybody help me with this. Because I'm using Azure MySQL db for Strapi CMS so all my Live sites going to be affected with this.

Thank you in advance.

Azure Database for MySQL
Azure Database for MySQL
An Azure managed MySQL database service for app development and deployment.
986 questions
0 comments No comments
{count} votes

Accepted answer
  1. GeethaThatipatri-MSFT 29,542 Reputation points Microsoft Employee Moderator
    2023-07-11T21:48:00.06+00:00

    Hi, @Riddhi Jadeja Welcome to Microsoft Q&A thanks for posting your question

    We perform DNS switch and cutover during auto-migration preserving the same connection string post migration. Both connection string and username formats (Single and Flexible Server) will be supported for the migrated Flexible Server, hence there are no source code changes needed to update the connection string.

     You can find more information about auto-migration here - In-place automigration from Azure Database for MySQL – Single Server to Flexible Server | Microsoft Learn

    Can you share your subscription name and server name for the test DB to this email to AzCommunity[at]Microsoft[dot]com

    Regards

    Geetha


1 additional answer

Sort by: Most helpful
  1. Yuvaraj Madheswaran 390 Reputation points
    2023-07-05T20:21:00.4966667+00:00

    Hi Riddhi Jadeja,

    Please find the flexible connection string setting from the below Azure documentation,
    https://learn.microsoft.com/en-us/azure/postgresql/migrate/concepts-single-to-flexible

    • Changing connection strings - Post successful validation, application should change their connection strings to point to flexible server. This activity is coordinated with the application team to make changes to all the references of connection strings pointing to single server. Note that in the flexible server the user parameter in the connection string no longer needs to be in the username@servername format. You should just use the user=username format for this parameter in the connection string For example Psql -h mysingleserver.postgres.database.azure.com -u user1@mysingleserver -d db1 should now be of the format Psql -h myflexserver.postgres.database.azure.com -u user1 -d db1

    This may address your concerns.

    Thanks!

    0 comments No comments

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.