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