Mac --> QSqlDatabase: QMYSQL driver not loaded
-
using install_name_tool, correct the path /opt/local/lib/mysql55/mysql/libmysqlclient.18.dylib in libqsqlmysql.dylib with /usr/local/mysql-5.6.19-osx10.6-x86//lib/libmysqlclient.18.dylib
-
When I'm in the correct directory, what lines I must insert in the terminal ?
-
install_name_tool -change old_path new_path libqsqlmysql.dylib
-
Hello SGaist,
I have tried your solution, with this instruction:
install_name_tool -change /opt/local/lib/mysql55/mysql/libmysqlclient.18.dylib /Applications/mampstack-5.4.26-0/mysql/lib/libmysqlclient.dylib libqsqlmysql.dylibbut during debug I receive this message:
@
QFactoryLoader::QFactoryLoader() checking directory path "/Users/warcomeb/Projects/build-LabOrToolGui-Desktop_Qt_5_2_1_clang_64bit/Debug/LabOrTool.app/Contents/MacOS/sqldrivers" ...
loaded library "/Users/warcomeb/Qt5.2.1/5.2.1/clang_64/plugins/sqldrivers/libqsqlmysql.dylib"
QSqlError(-1, "", "")
Database non connected!
QSqlError(2005, "QMYSQL: Unable to connect", "Unknown MySQL server host 'localhost:3306' (2)") @I have followed all step that you wrote previously!
Can you help me? -
Is your server running ?
Also, if it was deployed correctly, you should need to correct the path by hand. The client library should be already copied in your bundle
-
Yes, the server is running!
I have added setPort to my database configuration and now it work!Thanks!
Marco -
It's not work for my :'(
@install_name_tool -change /opt/local/lib/mysql55/mysql/libmysqlclient.18.dylib /Applications/mampstack-5.4.26-0/mysql/lib/libmysqlclient.dylib libqsqlmysql.dylib
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/install_name_tool: can't open file: libqsqlmysql.dylib (No such file or directory)
@what I must to do ? I'm on Yosemite now.
-
As silly as it may sound, use the correct path to libqsqlmysql.dylib
-
I don't understand what you mean.
One other thing when I run my project I have these lines :
@QSqlDatabase: QMYSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7@If it's available why it's not loaded.
-
@can't open file: libqsqlmysql.dylib (No such file or directory)@
You didn't run the command in the right folder since libqsqlmysql.dylib could not be found.
That generally happens when the plugin can't be loaded because e.g. it can't find one of the its dependencies