What you're trying to do won't work, because your code won't get to the show databases; until you exit from mysql.exe. The usual way to use mysql.exe from a script is to run the executable with each query:
$db = 'testasset'
$user = 'asset'
$pass = 'test'
$mysql = 'C:\Users\I16A1\Downloads\mysql\bin\mysql.exe'
$params = '-u', $user, '-p', $pass, $db
& $mysql @params -e 'SHOW DATABASES'
& $mysql @params -e '...'
...
Use splatting for providing the common parameters.
Normally you'd also add the parameters -B (--batch, non-interactive execution, no fancy output formatting) and -N (--skip-column-names, don't show column titles in output) to get more "digestible" output like this:
information_schema
mysql
performance_schema
test
instead of getting default output like this, that would require parsing the data out of the table for further processing:
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
With that said, a much better approach than working with the commandline client would be using the .Net Connector, e.g. like this:
$server = 'localhost'
$db = 'testasset'
$user = 'asset'
$pass = 'test'
$cs = "server=$server;user id=$user;password=$pass;database=$db;pooling=false"
[void][Reflection.Assembly]::LoadWithPartialName('MySQL.Data')
$cn = New-Object MySql.Data.MySqlClient.MySqlConnection
$cn.ConnectionString = $cs
$cn.Open()
$cmd= New-Object MySql.Data.MySqlClient.MySqlCommand
$cmd.Connection = $cn
$cmd.CommandText = 'SHOW DATABASES'
$reader = $cmd.ExecuteReader()
$tbl = New-Object Data.DataTable
$tbl.Load($reader)
$reader.Close()
$cn.Close()
$tbl | Format-Table -AutoSize
That way the output you get will be actual objects instead of strings.