execute mysql script from azure automation powershell runbook

Brian Melvin 1 Reputation point
2021-02-25T13:33:38.117+00:00

I have a mysql dump file (essentially a mysql sql script file) which i need to run against an azure mysql database

How do I do this within a powershell script in an azure automation runbook?

I've used azure cloud shell to do it before and the mysql.exe program seemed to be available out of the box, but the max timeout is too short so i'm trying to do this in azure automation instead.

When i tried it i got the message:
The term 'mysql' is not recognized as the name of a cmdlet, function, script file, or operable program.

thanks in advance

Azure Database for MySQL
Azure Database for MySQL
An Azure managed MySQL database service for app development and deployment.
746 questions
Azure Automation
Azure Automation
An Azure service that is used to automate, configure, and install updates across hybrid environments.
1,160 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. amon 121 Reputation points Microsoft Employee
    2021-02-25T16:08:02.603+00:00

    Hi @Brian Melvin
    All you need to do is import the sqlServer powershell module and make sure your sql server is accessible externally.
    Here is a nice blog about the subject.