How to Enable MySQL Support in Qt SDK for Linux
Known to work with:
- Slackware v13.37
- Qt SDK v1.1.5 (32 bit)
- Qt v4.8.0
- MySQL v5.5.18
Please follow this guide properly:
Download Qt SDK for Linux/X11 at Qt Software.
Install it anywhere you want, just make sure you remember the path. I installed mine at
/opt
.To build MySQL as a plugin, you need to know two other paths:
MySQL header directory’s files example:
MySQL library directory’s files example:
I installed my MySQL at
/opt
, so those files will be in:Go to your main Qt SDK installation’s path:
Some files with
mysql
in the name will be copied in your sqldrivers path:Before trying your MySQL coding, please make sure
libmysqlclient.so
is in theLD_LIBRARY_PATH
.Create a new project and put these codes to test your new plugin.
Make sure you have
mysql
included in your.pro
file.You should get
QMYSQL
in the outputs when you ran the application:You can find my info at http://qt-project.org/doc/qt-4.8/sql-driver.html.