sample my.cnf format for Azure database for mysql

Fiyin 1 Reputation point

Is there a sample document that shows how to configure the user parameter in the .my.cnf file? I can't get this to work


Azure Database for MySQL
Azure Database for MySQL
An Azure managed MySQL database service for app development and deployment.
464 questions
{count} votes

6 answers

Sort by: Most helpful
  1. Oury Ba-MSFT 10,171 Reputation points Microsoft Employee

    Hi @Fiyin Thank you for posting your question.

    This is not supported. Could you please tell us what you are trying to achieve and we can provide a better suggestion.


  2. Fiyin 1 Reputation point

    Hi @Oury Ba-MSFT ,

    The .my.cnf file allows username and password to be passed to scripts without having to specify the username and password in every script which allows the password or username to be changed in one location without having to change it in multiple scripts. Also, it allows our admins to connect to mysql on the commandline without having to specify a user and password everytime especially when troubleshooting issues where time is of the essence and the admin needs to log in and out of the database multiple times.


  3. Fiyin 1 Reputation point

    I also know there are some tools that look for the my.cnf file to read connection info to avoid mulitple prompts for the user or password.

  4. Oury Ba-MSFT 10,171 Reputation points Microsoft Employee

    Hello @Fiyin you can use Azure Active directory to achieve this goal and no need to update my.cnf as we are providing this feature out of the box for our customers.
    Use Azure Active Directory - Azure Database for MySQL | Microsoft Learn


  5. Fiyin 1 Reputation point

    Thanks for the update @Oury Ba-MSFT , is there an article that shows how to connect to Azure Active directory from a script in cron to obtain the credentials? A scheduled job can't do this part of the document

    Step 1: Authenticate with Azure AD
    Start by authenticating with Azure AD using the Azure CLI tool. This step is not required in Azure Cloud Shell.

    az login
    The command will launch a browser window to the Azure AD authentication page. It requires you to give your Azure AD user ID and the password.