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
[client]
host=cluster-1234.mysql.database.azure.com
user=adm@cluster-1234
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
[client]
host=cluster-1234.mysql.database.azure.com
user=adm@cluster-1234
@Mike-Ubezzi-MSFT @AnuragSharma-MSFT @KalyanChanumolu-MSFT @NavtejSaini-MSFT @OuryBa-MSFT Can I get help on this, it's been about 14hrs since I posted the question.
Hi @Fiyin-1202 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.
Regards,
Oury
Hi @OuryBa-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.
Regards,
Fiyin
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.
Hello @Fiyin-1202 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 Docs
Regards,
Oury
Thanks for the update @OuryBa-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.
Copy
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.
Hi @Fiyin-1202 thanks for replying back, I am not sure about CRON for Azure Auth but REST calls can work in this case. Let me please get more details about CRON and will get back shortly.
Regards,
Oury
Hi @OuryBa-MSFT,
DBAs and Sysadmins mostly use commandline to run different commands and scripts, using a config file prevents having to type username and password on the command prompt which can be visible when the history command is used to review past commands. A my.cnf file also allows for multiple credentials to be stored in a secure location so that I don't have to remember multiple usernames and passwords for different tasks as well as having to share the credentials with different users. Scheduled jobs in Cron is just a use case for the need for my.cnf file. There are other use cases as described above as well as tools and scripts that read the credentials from the my.cnf file. The username@host format of Azure MySQL database doesn't work.
Thanks,
Fiyin
@Fiyin-1202 Please try to connect with Managed identity. You can find the configuration sample here.
Regards,
Oury
Hi @Fiyin-1202 Please let us know if there is anything else we can assist you with.
Regards,
Oury
4 people are following this question.