Installing QMYSQL driver

前端 未结 1 1578
無奈伤痛
無奈伤痛 2021-01-24 06:20

Basically when I try to connect to the mysql database i get this error:

QSqlDatabase: QMYSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QODBC QOD         


        
相关标签:
1条回答
  • 2021-01-24 06:45

    Take a look at this post for Qt5, there's also a seperate set of instructions for Qt4 (although somewhat similar).

    Qt - How to get|compile Mysql driver

    1. Download a version of MySQL
    2. Download Qt source
    3. Build the MySQL plugin for Qt
    4. Copy the DLL from the MySQL install folder to a Qt folder (see link above)
    5. Copy the DLL you built for the Qt MySQL plugin to a Qt folder

    And obviously, when you distribute you'll need to remember to package those DLLs together (always check dependency walker)

    0 讨论(0)
提交回复
热议问题