Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QProcess SSH successful, now I want to sign in to MySql being served by the SSH Server
Forum Updated to NodeBB v4.3 + New Features

QProcess SSH successful, now I want to sign in to MySql being served by the SSH Server

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 588 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Katie Trombetta
    wrote on last edited by
    #1

    I am working on Mac Catalina and want to connect to MySql Database on MariaDB being served by an SSH remote server. My intentions is that I will be able to execute queries from within the QT App and get the query results back in QT.

    So far I have been able to set up the SSH connection using a QProcess. My next step is that I want to sign in to the MySql Database to begin writing and reading queries and query results.

    This is my code to connect to SSH.

    // Begin code
    QProcess *SSH = new QProcess();
    QString program;
    QStringList args;
    program = "ssh";
    args << "-T" << "-i" << "../../../../.ssh/qtc_id" << "<myusername>@<myhostname>";
    SSH->start(program, args);
    SSH->waitForFinished();
    QString output(SSH->readAllStandardOutput());
    qDebug() << output;
    output = SSH->readAllStandardError();
    qDebug() << output;
    // End code

    Does anyone know what to do next, in order to log in to mysql? Do I need a child QProcess? Do I need to implement the QIODevice? I have tried to read the documentation for these classes and have spent a week trying to figure this all out. I would appreciate advice in layman's terms as anything too advanced ends up being too difficult for me to follow, which is my problem to begin with, with just reading the documentation. Thank you so much in advance.

    jsulmJ 1 Reply Last reply
    0
    • K Katie Trombetta

      I am working on Mac Catalina and want to connect to MySql Database on MariaDB being served by an SSH remote server. My intentions is that I will be able to execute queries from within the QT App and get the query results back in QT.

      So far I have been able to set up the SSH connection using a QProcess. My next step is that I want to sign in to the MySql Database to begin writing and reading queries and query results.

      This is my code to connect to SSH.

      // Begin code
      QProcess *SSH = new QProcess();
      QString program;
      QStringList args;
      program = "ssh";
      args << "-T" << "-i" << "../../../../.ssh/qtc_id" << "<myusername>@<myhostname>";
      SSH->start(program, args);
      SSH->waitForFinished();
      QString output(SSH->readAllStandardOutput());
      qDebug() << output;
      output = SSH->readAllStandardError();
      qDebug() << output;
      // End code

      Does anyone know what to do next, in order to log in to mysql? Do I need a child QProcess? Do I need to implement the QIODevice? I have tried to read the documentation for these classes and have spent a week trying to figure this all out. I would appreciate advice in layman's terms as anything too advanced ends up being too difficult for me to follow, which is my problem to begin with, with just reading the documentation. Thank you so much in advance.

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Katie-Trombetta I never used MySql over SSH tunnel. Take a look at https://linuxize.com/post/mysql-ssh-tunnel/
      After establishing the SSH tunnel you should be able to access your database using https://doc.qt.io/qt-5/qtsql-index.html

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved