Hi all,
I need some help getting MySQL running with my Qt server application. There are lots of other posts/search results for this, but I have what may be basic questions that never seem to be answered.
My setup:
Linux Mint
Qt 5.4 (open source/community) installed from website to /home/matt/Qt
MySql Server 5.5 installed from repo
I’m trying to build a client/server application. While developing, the client, server and mysql server will all run on the same machine. When deployed all 3 can and will be running on different machines (client on Windows, server and mysql server on Linux).
According to this page [doc.qt.io]: Qt comes packaged with a driver for mysql and there is a file called libsqlmysql.so in this location:
/home/matt/Qt/5.4/gcc_64/plugins/sqldrivers/
But the page also says ‘not all of the plugins are provided with Open Source Versions of Qt’. So which drivers aren’t? I’ve tried to connect to my mysql database but get the following error:
QSqlDatabase: QMYSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QPSQL QPSQL7
using this code:
QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
db.setDatabaseName("mydb");
db.setHostName("localhost");
db.setUserName("dbuser");
db.setPassword("dbuserpwd");
Do I need to build the driver for mysql for my setup?
What are the actual requirements for getting this to work with my development setup (i.e. 1 machine) and later on with the server app and database server running on different machines?
Thanks!
↧