0

I am using same connection data, TCP/IP over SSH: ssh hostname, username, password, MySQL Hostname, server port, username, password

I have used MySql.Data.MySqlClient and MySqlConnector, and what I get is: "MySql.Data.MySqlClient.MySqlException: 'Authentication to host 'localhost' for user 'myuser' using method 'mysql_native_password' failed with message: Access denied for user 'myuser'@'localhost' (using password: YES)'" or "MySqlConnector.MySqlException: Access denied for user 'myuser'@'localhost' (using password: YES)'"

I am using the same user and password I use in workbench, where it runs ok

I have tried this code

connectionInfo = New PasswordConnectionInfo("w.x.y.z", 22, "MyUserSsl", "MyPasswordSsl") With {
        .Timeout = TimeSpan.FromSeconds(30)
        }
        client = New SshClient(connectionInfo)
        client.Connect()
        If Not client.IsConnected Then
            MsgBox("Wrong")
        End If

        portFwld = New ForwardedPortLocal("127.0.0.1", 0, "127.0.0.1", 3306)
        client.AddForwardedPort(portFwld)
        portFwld.Start()

        con = New MySqlConnection With {
        .ConnectionString = "port=" + CStr(portFwld.BoundPort) + ";Database=MyDB;Data Source=localhost;User Id=MyUserDB;Password=MyPassword"
             }

and this portFwld = New ForwardedPortLocal("127.0.0.1", 3305, "127.0.0.1", 3306)

and this portFwld = New ForwardedPortLocal("127.0.0.1", 3306, "127.0.0.1", 3306)

and also this

con = New MySqlConnection With {
        .ConnectionString = "Database=MyDB;Data Source=localhost;User Id=MyUserDB;Password=MyPassword"
        }
ElSherpa
  • 11
  • 2

1 Answers1

0

it looks like there is user permissions issue see gc5 answer:

"Connect failed: Access denied for user 'root'@'localhost' (using password: YES)" from php function

Abuelhija
  • 91
  • 4