QMYSQL driver available but not loaded

后端 未结 9 1141
Happy的楠姐
Happy的楠姐 2020-12-03 12:17

How do I load qmysql driver in Qt? I have the following code that produces these results:

(\"QSQLITE\", \"QMYSQL\", \"QMYSQL3\") 
QSqlDatabase:          


        
9条回答
  •  执念已碎
    2020-12-03 13:16

    We should check our driver first

    $ cd /opt/Qt5.2.1/5.2.1/gcc_64/plugins/sqldrivers
    

    then we can find some files

    Use the command below to check library

    $ ldd libqsqlmysql.so
    

    if you find the problem libmysqlclient_r.so.16 => not found it may be the library-dependency problem.

    After I did a little research on the Internet, there is a way would be easy.

    $ cd /usr/lib/x86_64-linux-gnu
    

    if you find libmysqlclient_r.so.18,

    $ cp libmysqlclient_r.so.18 libmysqlclient_r.so.16
    

提交回复
热议问题