PDA

View Full Version : cannot load mysql driver



saman_artorious
8th July 2012, 15:22
I got the error "cannot load mysql driver" or similar, when I wanted to connect to mysql db.

Although I could solve this problem via terminal, by copying the libqsqlmysql.so library to the folder qt software is installed and running
the below command:

qmake "INCLUDEPATH+=-Iusr/include/mysql" "LIBS+=-L/usr/lib/mysql -lmysqlclient_r" findMySQLDriver.pro

this worked out.

Now, the sad point is that I cannot make QtCreator connect to mysql at all,

in qtcreator I added sql to the .pro file, you know. but i donno how to transfer the terminal
solution to the creator .

Your

ChrisW67
9th July 2012, 01:08
Qt Creator doesn't load the MySQL driver: your program does. Your program tries to load the driver from a known location in your Qt install. If you have built and installed the MySQL driver for the version of Qt you are using then your program should have no issue finding it. The instructions for building the driver are in the docs. The instructions do not including manually copying a file anywhere.