I'm new to PowerShell. Is there a way in C# to call mysql.exe and execute a query using Powershell. I want to execute the query and covert the result into a csv file.
.\mysql.exe -C -B --host=amazonaws -P 3306 --user=user --password=pass --database=MyDB --execute="SELECT * FROM MyTable LIMIT 5" | Out-File "C:\output.sql"
using (PowerShell PowerShellInstance = PowerShell.Create())
{
????
PowerShellInstance.Invoke();
}
Thanks