SimplySql icon indicating copy to clipboard operation
SimplySql copied to clipboard

Open-MySqlConnection : Couldn't connect to server

Open suntong opened this issue 1 year ago • 3 comments

For the latest instalment/version, I'm getting this Open-MySqlConnection : Couldn't connect to server error without further hints. I checked get-help Open-MySqlConnection but didn't find more insightful options. Removing -WarningAction SilentlyContinue would not give more info either.

PS C:\> $sqlConnect = Open-MySqlConnection -ConnectionName MyDBCon -Server $DBServer -Database $DBName -Port 3306 -Credential $creds -WarningAction SilentlyContinue
Open-MySqlConnection : Couldn't connect to server
At line:1 char:15
+ ... qlConnect = Open-MySqlConnection -ConnectionName MyDBCon -Server $DBS ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OpenError: (MyDBCon:String) [Open-MySqlConnection], MySqlException
    + FullyQualifiedErrorId : OpenMySQLConnection.Error,SimplySql.Cmdlets.OpenMySqlConnection

PS C:\> $sqlConnect = Open-MySqlConnection -Server $DBServer -Database $DBName -Port 3306 -Credential $creds
Open-MySqlConnection : Couldn't connect to server
At line:1 char:15
+ ... qlConnect = Open-MySqlConnection -Server $DBServer -Database $DBName  ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OpenError: (default:String) [Open-MySqlConnection], MySqlException
    + FullyQualifiedErrorId : OpenMySQLConnection.Error,SimplySql.Cmdlets.OpenMySqlConnection

PS C:\> Test-NetConnection $DBServer -port 3306
ComputerName     : ....net
RemoteAddress    : ...
RemotePort       : 3306
InterfaceAlias   : Ethernet0
SourceAddress    : ...
TcpTestSucceeded : True

PS C:\> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      5.1.17763.5933
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.17763.5933
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Local connection with the above parameters works fine.
Any ways I can further troubleshoot this (like -SSLMode etc) please? thx

suntong avatar Sep 29 '24 01:09 suntong

try this

[link removed]

Password: changeme

Who is this SagarChandra07?

image

suntong avatar Sep 29 '24 02:09 suntong

Do not run that file! It is malware. The account has been spamming links to it all over GitHub. They use a password protected zip archive to evade the auto-check by MediaFire. I extracted it on a non-Windows machine and checked it manually. 17 positives.

thelabcat avatar Sep 29 '24 04:09 thelabcat

@suntong I have no idea who that is, i've deleted their comment. @thelabcat --thanks for the heads up.

@suntong as for your issue -- to get more details, run

# you may  want to clear errors first -- $error.Clear(), then run your code, then run the below
$Error | Select-Object *

mithrandyr avatar Sep 29 '24 10:09 mithrandyr

@suntong -- did you get any farther?

mithrandyr avatar Jan 24 '25 21:01 mithrandyr

Oh, sorry, didn't get around doing that. Let me close it for now.

suntong avatar Jan 27 '25 02:01 suntong