I would like to create an application that runs on a PC and connects to the mysql mariadb on my raspberry pi. I already managed to set it up on MySQL workbench, with the SSH connection options. However, I'd like to know how I can connect my app to that database.
Let's say my SSH is the default: username: pi password: raspberry
and for my database: host: localhost username: root password: Admin123
(these aren't the real logins, don't worry ;), but I don't feel like sharing the real information )
What would the code look like?
I'm familiar with
QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
db.setHostName("localhost");
db.setDatabaseName("mydb");
db.setUserName("root");
db.setPassword("Admin123");
bool ok = db.open();