0
    public void getConnection()
            {

                PasswordConnectionInfo connectionInfo = new PasswordConnectionInfo(AccessDBModel.Host,AccessDBModel.User,AccessDBModel.Pwd); 
                connectionInfo.Timeout = TimeSpan.FromSeconds(30);
                using (var client = new SshClient (connectionInfo)) 
                {
                    try
                    {
                        client.Connect();
                        if(client.IsConnected)
                        {
                            Console.WriteLine("SSH connection is started!");
                        }else
                        {
                            Console.WriteLine("SSH connection failed!");

                        }
                        var portFwdL = new ForwardedPortLocal(AccessDBModel.SqlIPA,AccessDBModel.SqlPort,AccessDBModel.SqlHost,AccessDBModel.SshPort);
                        client.AddForwardedPort(portFwdL);
                        portFwdL.Start();
                        if(portFwdL.IsStarted){
                            Console.WriteLine("Port forwarding is started!");
                        }else{
                            Console.WriteLine("Port forwarding failed!");
                        }

                        string strConnection = AccessDBModel.SqlConn;
                        MySqlConnection conn = new MySqlConnection(strConnection); 
                        MySqlDataAdapter dataAdapter = new MySqlDataAdapter();
                        conn.Open();



                    }catch(Exception e)
                    {
                        Console.WriteLine(e.ToString());
                    }
                }
       }

I am trying to use

using MySql.Data.MySqlClient;
using Renci.SshNet;
using Renci.SshNet.Common;

to connect to remote mysql server, i refer to https://www.youtube.com/watch?v=YUhlS47SccU&spfreload=10

But the first 2 connection is started, but when i do conn.open(), it shows:

MySql.Data.MySqlClient.MySqlException: Authentication to host '127.0.0.1' for user 'username' using method 'mysql_native_password' failed with message: Access denied for user 'username'@'RemoteHostName' (using password: NO) ---> MySql.Data.MySqlClient.MySqlException: Access denied for user 'dataviz15'@'bastet.labs.esilv.fr' (using password: NO) at MySql.Data.MySqlClient.MySqlStream.ReadPacket () [0x00000] in :0 at MySql.Data.MySqlClient.NativeDriver.ReadPacket () [0x00000] in :0 at MySql.Data.MySqlClient.Authentication.MySqlAuthenticationPlugin.ReadPacket () [0x00000] in :0 --- End of inner exception stack trace ---

lly
  • 1
  • 2
  • It is not duplicate, it is a different problem than those other questions, please – lly Jun 02 '15 at 13:07
  • You might need to amend your question to illustrate what's different or what you've tried that indicates that the "duplicate" does not solve your problem. – D Stanley Jun 02 '15 at 14:40
  • because it is not for my problem, i need A, it says B.... – lly Jun 02 '15 at 15:21

0 Answers0