-1

I am trying to get a database from a Linux box and am doing it using WinSCP .NET assembly with the following code:

SessionOptions sessionSettings = new SessionOptions
{
    Protocol = Protocol.Scp,
    HostName = "******",
    UserName = "*****",
    Password = "*****",
    SshHostKeyFingerprint = "****************************"
};

using (Session session = new Session())
{
   session.Open(sessionSettings);

    TransferOperationResult ibData = session.GetFiles("/var/lib/mysql/ibdata1", @"Documents\Visual Studio 2015\Projects\Project1\Project1\Database\ibdata1.myd");
    ibData.Check();
    TransferOperationResult ib_logfile0 = session.GetFiles("/var/lib/mysql/ib_logfile0", @"Documents\Visual Studio 2015\Project1\Project1\Database\ib_logfile0");
    ib_logfile0.Check();
    TransferOperationResult ib_logfile1 = session.GetFiles("/var/lib/mysql/ib_logfile1", @"Documents\Visual Studio 2015\Projects\Project1\Project1\Database\ib_logfile1");
    ib_logfile1.Check();
    TransferOperationResult mysql = session.GetFiles("/var/lib/mysql/mysql", @"Documents\Visual Studio 2015\Project1\Project1\Database\mysql");
    mysql.Check();
    TransferOperationResult oreka = session.GetFiles("/var/lib/mysql/oreka", @"Documents\Visual Studio 2015\Projects\Project1\Project1\Database\oreka");
    oreka.Check();
    TransferOperationResult test = session.GetFiles("/var/lib/mysql/test", @"Documents\Visual Studio 2015\Projects\Project1\Project1\Database\test");
    test.Check();
}

Now that I have the database from /var/lib/mysql, I don't know how I am suppose to extract the data I need to continue. How would I go about doing that?

Martin Prikryl
  • 147,050
  • 42
  • 335
  • 704
Lotzi11
  • 373
  • 1
  • 8
  • 21

1 Answers1

0

Your question is hardly clear.

But I suppose you want to dump a database to a file using the mysqldump command and then download the dump.

You can use the Session.ExecuteCommand method to call the mysqldump. But you obviously need a shell access to the server to do do that.

Martin Prikryl
  • 147,050
  • 42
  • 335
  • 704