Difference between revisions of "MySQL and PowerShell"

Jump to navigation Jump to search
→‎Connect: Made function names consistent
m (Minor reformatting, and Meta)
(→‎Connect: Made function names consistent)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
{{#widget:Widget:GoogleAdSenseSkyscraper}}
To be able to interact with a MySQL database from PowerShell you need to have the MySQL .NET Connector installed first on the machine that you're going to run PowerShell from - http://dev.mysql.com/downloads/connector/net/
To be able to interact with a MySQL database from PowerShell you need to have the MySQL .NET Connector installed first on the machine that you're going to run PowerShell from - http://dev.mysql.com/downloads/connector/net/


Line 35: Line 36:
Improved connect function with error catcher...
Improved connect function with error catcher...
<source lang="powershell">
<source lang="powershell">
function ConnectMySQL([string]$user, [string]$pass, [string]$MySQLHost, [string]$database) {  
function Connect-MySQL([string]$user, [string]$pass, [string]$MySQLHost, [string]$database) {  
     # Load MySQL .NET Connector Objects  
     # Load MySQL .NET Connector Objects  
     [void][system.reflection.Assembly]::LoadWithPartialName("MySql.Data")  
     [void][system.reflection.Assembly]::LoadWithPartialName("MySql.Data")  
Line 59: Line 60:
}  
}  
</source>
</source>
{{#widget:Widget:GoogleAdSenseSkyscraper}}


= Commands =
= Commands =

Navigation menu