Connect MySQL Database to Powershell

preview_player
Показать описание
connect mysql to powershell
Connecting PowerShell to MySQL Database
MySQL Connection with PowerShell Scripting
How do I connect to MySQL database via Powershell
How To Query a MySQL Database with PowerShell
Run MySQL Queries from PowerShell
------------------------------------------------------------------------
connect mysql with powershell using codes. use following codes
----------------------------------------------------------------------

$Connection = New-Object MySQL.Data.MySqlClient.MySQLConnection("User=root;Database=sakila;Server=localhost;Port=3306;")
$Connection.Open()

# Define a MySQL Command Object for a non-query.
$sql = New-Object MySql.Data.MySqlClient.MySqlCommand
$sql.Connection = $Connection
$sql.CommandText = "SHOW Tables"
$myreader = $sql.ExecuteReader()
while($myreader.Read()){ $myreader.GetString(0) }
$myreader.Close()

#powershellscripting #mysql
Рекомендации по теме
Комментарии
Автор

Qual era a versão do MySQL/MariaDB? Parece estar com erro a partir da versão 10.10 "Object cannot be cast from DBNull to other types."

deh