[SOLVED]QT5 unable to build MySQL driver under ubuntu
-
wrote on 14 Jun 2013, 07:38 last edited by
I have mysql installed
when i run mysql --version
i get
mysql Ver 14.14 Distrib 5.5.29, for debian-linux-gnu (x86_64) using readline 6.2
But When i try to connect MySql With Qt uisng QSqldatabase it give the error belowQSqlDatabase: QMYSQL driver not loaded
QSqlDatabase: available drivers: QSQLITEFrom where to start now can you tell me
-
wrote on 14 Jun 2013, 07:44 last edited by
[quote author="anubhav87" date="1371195516"]I have mysql installed
when i run mysql --version
i get
mysql Ver 14.14 Distrib 5.5.29, for debian-linux-gnu (x86_64) using readline 6.2
But When i try to connect MySql With Qt uisng QSqldatabase it give the error belowQSqlDatabase: QMYSQL driver not loaded
QSqlDatabase: available drivers: QSQLITEFrom where to start now can you tell me [/quote]
The system show you that you havn't Qt plugin for MySQL (you have SQLite) so try to build your own Qt MySQL plugin from https://qt-project.org/doc/qt-5.0/qtsql/sql-driver.html#qmysql
PS
I suppose you're using Qt5 -
wrote on 14 Jun 2013, 07:54 last edited by
Yes I am using Qt5
-
wrote on 14 Jun 2013, 08:01 last edited by
[quote author="anubhav87" date="1371196499"]Yes I am using Qt5[/quote]
Try to use the mentioned steps above and don't forget to read documentation page I've linked it to you :)
-
wrote on 14 Jun 2013, 10:01 last edited by
Where you've installed Qt5 on your machine?
-
wrote on 14 Jun 2013, 10:22 last edited by
My Home Folder (Linux Mint 14.0)
-
wrote on 14 Jun 2013, 11:53 last edited by
OK, try to do the following (considering installation directory is /home/usename/Qt5.0.2):
@usename@usename-pc ~ $ sudo apt-get install tasksel
usename@usename-pc ~ $ sudo tasksel install LAMP
usename@usename-pc ~ $ sudo tasksel install libmysqlclient-dev
usename@usename-pc ~ $ cd /home/usename/Qt5.0.2/5.0.2/Src/qtbase/src/plugins/sqldrivers/mysql
usename@usename-pc ~ $ /home/usename/Qt5.0.2/5.0.2/gcc_64/bin/qmake "INCLUDEPATH+=/usr/include/mysql" "LIBS+=-L/usr/lib/x86_64-linux-gnu -lmysqlclient_r" mysql.pro
usename@usename-pc ~ $ make
usename@usename-pc ~ $ make install@ -
wrote on 14 Jun 2013, 12:28 last edited by
As you said i did that too but again where is this mysql.pro
my output as you said
username@username ~ $ sudo tasksel
[sudo] password for username:
sudo: tasksel: command not found
username@username ~ $ cd Qt5.0.0/5.0.0/
username@username ~/Qt5.0.0/5.0.0 $ cd gcc_64/
username@username ~/Qt5.0.0/5.0.0/gcc_64 $ cd plugins/
username@username ~/Qt5.0.0/5.0.0/gcc_64/plugins $ cd sqldrivers/
username@username ~/Qt5.0.0/5.0.0/gcc_64/plugins/sqldrivers $ /home/username/Q
Qt5.0.0/ QT_APP/
username@username ~/Qt5.0.0/5.0.0/gcc_64/plugins/sqldrivers $ /home/username/Qt5.0.0/5.0.0/gcc_64/bin/qm
qmake qmlmin qmlscene
qml1plugindump qmlplugindump qmltestrunner
qmlbundle qmlprofiler qmlviewer
username@username ~/Qt5.0.0/5.0.0/gcc_64/plugins/sqldrivers $ /home/username/Qt5.0.0/5.0.0/gcc_64/bin/qmake "INCLUDEPATH+=/usr/include/mysql" "LIBS+=-L/usr/lib/x86_64-linux-gnu^C
username@username ~/Qt5.0.0/5.0.0/gcc_64/plugins/sqldrivers $ /home/username/Qt5.0.0/5.0.0/gcc_64/bin/qmake "INCLUDEPATH+=/usr/include/mysql" "LIBS+=-L/usr/lib/x86_64-linux-gnu -lmysqlclient_r" mysql.pro
Cannot find file: mysql.pro.
username@username ~/Qt5.0.0/5.0.0/gcc_64/plugins/sqldrivers $ -
wrote on 14 Jun 2013, 12:52 last edited by
-
wrote on 14 Jun 2013, 12:58 last edited by
It seems that you didn't install Qt into your home directory. Try to run find where Qt installed.
-
wrote on 17 Jun 2013, 03:46 last edited by
Below is the path where i have installed my qt
/home/myusername/Qt5.0.0
14/20