-   Programming (
-   -   Connecting MySQL database to Qt under Linux (

lingodeles 01-26-2013 04:09 PM

Connecting MySQL database to Qt under Linux
Hi. Thank you for that!
I'm programming a Qt application under Linux Fedora, and i want to connect it with a MySQL database.
I have the QMySQL, MySQL and Qt 4.8 . I learned that i have to compile the driver. I've try many time to but still not yet. I could not use qmake command. It seems that it isn't a shell command!!!
So could someone helps me to do it. I'm stopped here since 2 weeks!!

millgates 01-26-2013 04:25 PM


Originally Posted by lingodeles (Post 4878152)
I have [...] Qt 4.8 .
It seems that it isn't a shell command!!!

Do you also have qt-devel package?

lingodeles 01-26-2013 05:06 PM

Yes i have. but i dont know how to use it...

millgates 01-27-2013 03:42 AM

Can you post the exact command(s) you are trying to run and whatever error you are getting?

lingodeles 01-27-2013 05:40 AM

Of course!
qmake "INCLUDEPATH+=/usr/lib64/mysql/include" "LIBS+=-L/usr/local/lib -lmysqlclient_r"
and error:
bash: qmake: command not found...
Similar command is: 'make'

Then i've try:
make "INCLUDEPATH+=/usr/lib64/mysql/include" "LIBS+=-L/usr/local/lib -lmysqlclient_r"

and the error becomes:
ake: *** No rule to make target `'. Stop.

Seriouly i didn't understand anything!

millgates 01-27-2013 06:54 AM

Do you know where qmake is installed on your system? May be something like


You'll have to either specify the full path or add the directory to your $PATH.

knudfl 01-27-2013 07:32 AM

Fedora, qt-devel-4.x.x :

/usr/lib/qt4/bin/qmake , and /usr/bin/qmake-qt4

You can get a binaries file list with :
$ rpm -ql qt-devel | grep bin

lingodeles 01-27-2013 08:02 AM

Yes i know it.
It is in: /usr/lib64/qt4/bin/qmake.
I specified the full in the command like this:

/usr/lib64/qt4/bin/qmake "INCLUDEPATH+=/usr/lib64/mysql/include" "LIBS+=-L/usr/local/lib -lmysqlclient_r"

and it gives me a new error:

Cannot find file:

Which ""? Must i download it again?
I've already downloaded the qt-devel package and also the QMysql...

knudfl 01-27-2013 10:22 AM


What exactly is it you are trying to compile ? ?

lingodeles 01-27-2013 10:41 AM

in fact i want just to connect my Qt application with a MySQL database. For make this connection, i read that i must build the driver in local, that's why i'm doing all that: i really need helps and seriously, even if you have an easier solution, please give it to me. I'm going to be crazy with this Qt/MySQL connection!!!

All times are GMT -5. The time now is 03:33 AM.