Answer the question
In order to leave comments, you need to log in
How to connect to MySQL through Powershell 2.0?
Good afternoon, I'm trying to connect using Powershell (2.0) to MySQL (I use the dll file from the version under NetFramework 2.0, because connections will be made from computers where powershell 2.0)
[void][System.Reflection.Assembly]::LoadFrom("С:\temp\MySql.Data.dll")
$connection=New-Object MySql.Data.MySqlClient.MySqlConnection
$connection.ConnectionString="server=database_hostname;user=user_name;password=user_password;database=database_name"
$connection.Open()
$connection.Close()
PS C:\Users\strelkov.av> C:\Users\strelkov.av\Desktop\mysql.ps1
Исключение при чтении "formatValueList" : "Microsoft.PowerShell.Commands.Internal.Format.FreeFormatEntry.formatValueList"
+ CategoryInfo : NotSpecified: (:) [out-lineoutput], GetValueInvocationException
+ FullyQualifiedErrorId : CatchFromBaseAdapterGetValue,Microsoft.PowerShell.Commands.OutLineOutputCommand
Answer the question
In order to leave comments, you need to log in
They write that this happens when the downloaded dll'ka is located somewhere on the network, and not on the local disk.
at you c:\temp a case not on a network is mounted?
also make sure the dll is unlocked. right click on the dll file, properties and at the bottom of the properties look for unblock / unblock.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question