Use MySQL console through a PowerShell script
<p>I have to write a PowerShell script that needs to use the <code>mysql.exe</code> console and execute some queries. I started it:</p>

<pre><code>$mysqlC = 'C:\Users\I16A1\Downloads\mysql\bin\mysql.exe'
$arg1 = '-u asset -ptest testasset'
&amp; $mysqlC $arg1

show databases;
</code></pre>

<p>As you can see, after setting the console placement and the arguments of connection, I use the call operator (<code>&amp;</code>) to run the MySQL console.</p>

<p>Everything is fine, MySQL console is running but the lines after the call operator are not running, like <code>show databases;</code>.</p>

<p>The thing is I want my PowerShell script to do everything on its own.</p>

<p>Someone know a way to do it? Maybe differently?</p>