Âü°í : http://markalexanderbain.suite101.com/connecting-to-mysql-from-powershell-a117797
Getting Started with Powerscript and the MySQL .NET
Connector
1. Download Connector .net
¿¹Á¦¿¡¼´Â ¿ø°Ý¿¡¼ ·Î±ä½Ãµµ...
2. example.ps1
[void][System.Reflection.Assembly]::LoadWithPartialName("MySql.Data")
$connectionString = "server=XXXX;uid=XXX;pwd=XXXX;database=XXXX;"
$connection = New-Object MySql.Data.MySqlClient.MySqlConnection
$connection.ConnectionString = $connectionString
$connection.Open()
$sql = "select * from TABLE_NAME where UnixTimeStamp='1336683600'"
$command = New-Object MySql.Data.MySqlClient.MySqlCommand($sql, $connection)
$dataAdapter = New-Object MySql.Data.MySqlClient.MySqlDataAdapter($command)
$dataSet = New-Object System.Data.DataSet
$recordCount = $dataAdapter.Fill($dataSet, "sample_data")
$dataSet.Tables["sample_data"]
$connection.Close()
3. ½ÇÇà°á°ú