QSqlDatabase: QMYSQL3 driver not loaded?
-
Hi,
I am running the sqlbrowser example project, which connects fine with SQLITE but not with MYSQL. I get this error:QSqlDatabase: QMYSQL3 driver not loaded
What could be going on?
Thanks
Juan -
Sorry, a mistake. Correct modification to *.pro is:
wince {
DEPLOYMENT_PLUGIN += qsqlite
# JDH added next
DEPLOYMENT_PLUGIN += qmysql
} -
Hi,
Do you have the MySQL client library installed ?
-
No, those are the Qt plugins. You need to verify that your OS has the MySQL client libraries installed.
-
No, it does not. Are you running OS X ?
-
Then unless you installed it using brew/macports or the official MySQL package. You won't have the client library.
-
Hi,
I apologise for making a question that probably should be answered by MySQL web site but I have not found any answer .. maybe someone that has a lot of experience with MySql can find it very easy to direct my attention to where I can figure out if the client library is available. Does it need to be in a PATH or another environment variable? Do I place that in bash_profile or bashrc?
I downloaded the mysql-connector-c-6.1.6-osx10.8-x86_64 source and it has the following libraries in the lib subdir:
libmysqlclient.a
libmysqlclient.dylib
libmysqlclient.18.dylib
libmysqlclient_r.a
libmysqlclient_r.dylib
libmysqlclient_r.18.dylibHow do I put them so Qt Creator will find them? These ARE the client libraries right?
Thanks again!!
Juan -
Yes, these are the client libraries.
Now run
otool -L path/to/qsqlmysql.dylib
. You will get the list of dependencies of the plugin with an entry concerning the MySQL client library. You will have to runinstall_name_tool -change current/path/to/client_library your/path/to/client/library qsqlmysql.dylib
-
Yes, these are the client libraries.
Now run
otool -L path/to/qsqlmysql.dylib
. You will get the list of dependencies of the plugin with an entry concerning the MySQL client library. You will have to runinstall_name_tool -change current/path/to/client_library your/path/to/client/library qsqlmysql.dylib