Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Setting up MySQL for Qt on Ubuntu

Setting up MySQL for Qt on Ubuntu

Scheduled Pinned Locked Moved Installation and Deployment
7 Posts 6 Posters 6.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    TITU
    wrote on last edited by
    #1

    Hello!
    I am new to Qt, and I've been trying to set up qt to be able to use mysql.
    I'm not really sure what I should do...
    Do I have to install some drivers or what?
    I am asking now, what should I do to get it working on Ubuntu.

    Thanks already in advance

    1 Reply Last reply
    0
    • U Offline
      U Offline
      ucomesdag
      wrote on last edited by
      #2

      @sudo apt-get install libmysqlclient-dev
      cd $QTDIR/src/plugins/sqldrivers/mysql
      qmake "INCLUDEPATH+=/usr/include/mysql" "LIBS+=-L/usr/lib/mysql -lmysqlclient_r" mysql.pro
      make
      make install@

      Write “Qt”, not “QT” (QuickTime).

      1 Reply Last reply
      0
      • T Offline
        T Offline
        TITU
        wrote on last edited by
        #3

        [quote author="ucomesdag" date="1296058771"]@sudo apt-get install libmysqlclient-dev
        cd $QTDIR/src/plugins/sqldrivers/mysql
        qmake "INCLUDEPATH+=/usr/include/mysql" "LIBS+=-L/usr/lib/mysql -lmysqlclient_r" mysql.pro
        make
        make install@[/quote]

        Thanks for the reply, but I didn't succeed to finish it.
        When I tried the make, it gave me this error:

        @~/qtsdk-2010.05/qt/src/plugins/sqldrivers/mysql$ make
        g++ -c -pipe -O2 -fvisibility=hidden -fvisibility-inlines-hidden -D_REENTRANT -Wall -W -fPIC -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_DEBUG -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtSql -I/usr/include/qt4 -I/usr/include/mysql -I. -o main.o main.cpp
        main.cpp:42: fatal error: qsqldriverplugin.h: File or folder does not exist
        compilation terminated.
        make: *** [main.o] Error 1
        @

        What could go wrong?

        1 Reply Last reply
        0
        • D Offline
          D Offline
          dangelog
          wrote on last edited by
          #4

          You're using the wrong qmake.

          Software Engineer
          KDAB (UK) Ltd., a KDAB Group company

          1 Reply Last reply
          0
          • O Offline
            O Offline
            Olorin5800
            wrote on last edited by
            #5

            Try and apt-get libqt4-sql and libqt4-sql-mysql or something similar the easy way to get qt on ubuntu is to apt get qt-creator and qt and if you need extra drivers for sql just use the previous commands i wrote apt-get libqt4-sql and libqt4-sql-mysql for mysql libqt4-sql-psql for postgre etc you get the point.


            My programs never have bugs, they just develop random features.

            1 Reply Last reply
            0
            • 1 Offline
              1 Offline
              17elcapo
              wrote on last edited by
              #6

              the sdk. It doesn't exist.[/quote]

              My friend try go in Qt Tools>Options>QtVersions>In Autodetected chose you Qt compiler>Look down click on Qt version 5 Details. Now look you PLUGINS folder and go. In sqldrivers folder check file libqsqlmysql.so exist and ins not protected.
              If u not have this file download form Ubuntu software center searching libqt5 for QT5 or liqt4 for QT4 and install later copy the installed file /usr/lib/x86_64-linux-gnu/qt5/plugins/sqldrivers for 64bits machine or /usr/lib/i386-linux-gnu/qt5/plugins/sqldrivers for 32bits machine. to you plugins proyect folder
              Sorry for my english regars from Argentina

              1 Reply Last reply
              1
              • L Offline
                L Offline
                lfcramer
                wrote on last edited by
                #7

                Tried many other suggestions and all failed. This one is straightforward and worked. In Ubuntu repository, search for 'Qt 5 MySQL', install and done!

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved