QProcess SSH successful, now I want to sign in to MySql being served by the SSH Server
-
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 codeDoes 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.
-
@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