0

I am setting up a new Azure database using mysql server with a database. I want to dump a .sql file to this database using powershell

Executing the below code throws exception in '<', since it is reserved for future use, as a workaround I tired putting the entire statement in quotes.Still facing same issue.

$path = "C:\tools\mysql\current\bin\mysql.exe" &"$path" -h $servername -u $username -p $databasename < filename.sql

The expected result is to dump the filename.sql into mysql server database.

2

1 Answer 1

0

Try something like this and see if it helps:

Use Get-Content to read the file and pipe | it to your command. Use & to run the command.

get-content 'c:\folder\backup.sql' | &"C:\Program Files\MySQL\MySQL Server 5.7\bin\mysql.exe" -u user --password=pass dbnamedbname
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.