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. Install mysql driver for qt in ubuntu
Forum Updated to NodeBB v4.3 + New Features

Install mysql driver for qt in ubuntu

Scheduled Pinned Locked Moved Installation and Deployment
47 Posts 8 Posters 66.1k 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.
  • D Offline
    D Offline
    DenisKormalev
    wrote on last edited by
    #27

    Make itself outputs all steps of build. It shows you all compiling and linking operations it runs.

    If make was successfull it should create libqmysql.so file which you should place into plugins/sqldrivers folder

    1 Reply Last reply
    0
    • D Offline
      D Offline
      doforumda
      wrote on last edited by
      #28

      yes the libqmysql.so has been created and i copy it to the folder you specified. Now is it ready to use? can i start coding for in qt for mysql db?

      1 Reply Last reply
      0
      • D Offline
        D Offline
        DenisKormalev
        wrote on last edited by
        #29

        Yes, all should be ok now. To check it just output content of
        @
        QSqlDatabase::drivers ()
        @
        QMYSQL should be there.

        1 Reply Last reply
        0
        • D Offline
          D Offline
          doforumda
          wrote on last edited by
          #30

          thanks alot.

          alittle more help will be appreciated. I have never used mysql in linux environment. I use it in windows by making web application in PHP. it is quit simple in windows because i just download wamp and install it and everything works perfectly i can create edit or delete databases and table through wamp very easily. i need alittle help here about how can i make database and tables in mysql in linux platform?

          once again thanks alot for your help

          1 Reply Last reply
          0
          • D Offline
            D Offline
            DenisKormalev
            wrote on last edited by
            #31

            You can either do it via console (by running mysql command) or you can install apache+php+phpmyadmin for web interface or you can install one of desktop GUI mysql clients.

            1 Reply Last reply
            0
            • D Offline
              D Offline
              doforumda
              wrote on last edited by
              #32

              well when i run mysql command it says this
              @
              the program "mysql" can be found in the following packages:
              mysql-client-core-5.1
              mysql-client-5.0
              mysql-cluster-client-5.1
              try sudo apt-get install <selected-package>
              @

              which package should i install for creating databse

              1 Reply Last reply
              0
              • D Offline
                D Offline
                DenisKormalev
                wrote on last edited by
                #33

                it depends on what server version do you have. You need client with same version.

                1 Reply Last reply
                0
                • D Offline
                  D Offline
                  doforumda
                  wrote on last edited by
                  #34

                  whatever we did in this thread it did not install mysql server? it installs mysql driver for qt?

                  1 Reply Last reply
                  0
                  • D Offline
                    D Offline
                    DenisKormalev
                    wrote on last edited by
                    #35

                    Yes we've installed only driver for qt. If you want to store databases at your computer you need to install both mysql-server and mysql-client. If you will connect to remote database you can install only mysql-client.

                    1 Reply Last reply
                    0
                    • D Offline
                      D Offline
                      doforumda
                      wrote on last edited by
                      #36

                      will it work if i install mysql server and client after installing mysql driver for qt? or if i install xamp then it will also work with qt. i am not using qt for web interface. i am using qt just to create desktop and mobile apps.

                      1 Reply Last reply
                      0
                      • D Offline
                        D Offline
                        DenisKormalev
                        wrote on last edited by
                        #37

                        Yes it should work. For better compatibility install client with exactly same version as your installed dev packages.

                        1 Reply Last reply
                        0
                        • D Offline
                          D Offline
                          doforumda
                          wrote on last edited by
                          #38

                          how would i know the version of my installed dev packages(by dev packages you mean which i installed for qt now).

                          and your reply "Yes it should work." means xamp will also work??

                          1 Reply Last reply
                          0
                          • D Offline
                            D Offline
                            DenisKormalev
                            wrote on last edited by
                            #39

                            You SHOULD have mysql-server to be able to store and work with mysql databases at your computer.
                            Mysql-client is set of libraries and binaries which give access to mysql server (your or remote) for other applications or for you directly from console (mysql utility I'e mentioned before).
                            As I've seen earlier in thread you've installed mysql dev packages for mysql 5.0, so you need to install server and client versioned 5.0.

                            1 Reply Last reply
                            0
                            • D Offline
                              D Offline
                              doforumda
                              wrote on last edited by
                              #40

                              ok i created a db "testTwo" in xampp. that db is in opt/lampp/var/mysql/testTwo folder. Now if i want to use this db then will code in my qt will get this db automatically when i provide QSqlDatabase db->setDatabaseName("testTwo"); or i need to copy this db somewhere else to make it available for qt?

                              1 Reply Last reply
                              0
                              • D Offline
                                D Offline
                                DenisKormalev
                                wrote on last edited by
                                #41

                                I've never worked with xampp, but if it has mysql server in it and this server is running then all should be ok.

                                1 Reply Last reply
                                0
                                • D Offline
                                  D Offline
                                  doforumda
                                  wrote on last edited by
                                  #42

                                  can you please check this thread i have some problem in loading mysql driver? "Your text to link here...":http://developer.qt.nokia.com/forums/viewthread/1208/

                                  1 Reply Last reply
                                  0
                                  • S Offline
                                    S Offline
                                    swhweng
                                    wrote on last edited by
                                    #43

                                    Yet can't install according to above.
                                    Why I get

                                    @***Unknown option -lmysqlclient_r”@

                                    when running

                                    @qmake “INCLUDEPATH+=/usr/include/mysql” “INCLUDEPATH+=/home/paul01/QtSDK/Desktop/Qt/4.8.0/gcc/include/Qt” “LIBS+=-L/usr/lib/mysql -lmysqlclient_r” mysql.pro@

                                    and next errors after make :

                                    @paul01@paul01UbInsp:~/QtSDK/QtSources/4.8.0/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:30: error: qsqldriverplugin.h: No such file or directory
                                    main.cpp:43:25: error: qstringlist.h: No such file or directory
                                    In file included from main.cpp:47:
                                    ../../../sql/drivers/mysql/qsql_mysql.h:45:30: error: QtSql/qsqldriver.h: No such file or directory
                                    ../../../sql/drivers/mysql/qsql_mysql.h:46:30: error: QtSql/qsqlresult.h: No such file or directory
                                    In file included from main.cpp:47:
                                    ../../../sql/drivers/mysql/qsql_mysql.h:60: error: ‘QT_BEGIN_HEADER’ does not name a type
                                    ../../../sql/drivers/mysql/qsql_mysql.h:70: error: expected class-name before ‘{’ token
                                    ../../../sql/drivers/mysql/qsql_mysql.h:77: error: ‘QVariant’ does not name a type
                                    ../../../sql/drivers/mysql/qsql_mysql.h:84: error: ‘QVariant’ does not name a type
                                    ../../../sql/drivers/mysql/qsql_mysql.h:86: error: ISO C++ forbids declaration of ‘QString’ with no type
                                    ../../../sql/drivers/mysql/qsql_mysql.h:86: error: expected ‘,’ or ‘...’ before ‘&’ token
                                    ../../../sql/drivers/mysql/qsql_mysql.h:89: error: ‘QVariant’ does not name a type
                                    ../../../sql/drivers/mysql/qsql_mysql.h:90: error: ‘QSqlRecord’ does not name a type
                                    ../../../sql/drivers/mysql/qsql_mysql.h:95: error: ISO C++ forbids declaration of ‘QString’ with no type
                                    ../../../sql/drivers/mysql/qsql_mysql.h:95: error: expected ‘,’ or ‘...’ before ‘&’ token
                                    ../../../sql/drivers/mysql/qsql_mysql.h:103: error: expected class-name before ‘{’ token
                                    ../../../sql/drivers/mysql/qsql_mysql.h:104: error: ISO C++ forbids declaration of ‘Q_OBJECT’ with no type
                                    ../../../sql/drivers/mysql/qsql_mysql.h:105: error: expected ‘;’ before ‘friend’
                                    ../../../sql/drivers/mysql/qsql_mysql.h:107: error: expected ‘)’ before ‘’ token
                                    ../../../sql/drivers/mysql/qsql_mysql.h:108: error: ‘QObject’ has not been declared
                                    ../../../sql/drivers/mysql/qsql_mysql.h:110: error: ‘DriverFeature’ has not been declared
                                    ../../../sql/drivers/mysql/qsql_mysql.h:111: error: ISO C++ forbids declaration of ‘QString’ with no type
                                    ../../../sql/drivers/mysql/qsql_mysql.h:111: error: expected ‘,’ or ‘...’ before ‘&’ token
                                    ../../../sql/drivers/mysql/qsql_mysql.h:118: error: ISO C++ forbids declaration of ‘QSqlResult’ with no type
                                    ../../../sql/drivers/mysql/qsql_mysql.h:118: error: expected ‘;’ before ‘
                                    ’ token
                                    ../../../sql/drivers/mysql/qsql_mysql.h:119: error: ‘QStringList’ does not name a type
                                    ../../../sql/drivers/mysql/qsql_mysql.h:120: error: ‘QSqlIndex’ does not name a type
                                    ../../../sql/drivers/mysql/qsql_mysql.h:121: error: ‘QSqlRecord’ does not name a type
                                    ../../../sql/drivers/mysql/qsql_mysql.h:122: error: ‘QString’ does not name a type
                                    ../../../sql/drivers/mysql/qsql_mysql.h:124: error: ‘QVariant’ does not name a type
                                    ../../../sql/drivers/mysql/qsql_mysql.h:125: error: ‘QString’ does not name a type
                                    ../../../sql/drivers/mysql/qsql_mysql.h:127: error: expected ‘:’ before ‘Q_SLOTS’
                                    ../../../sql/drivers/mysql/qsql_mysql.h:128: error: expected primary-expression before ‘bool’
                                    ../../../sql/drivers/mysql/qsql_mysql.h:128: error: ISO C++ forbids declaration of ‘Q_SLOTS’ with no type
                                    ../../../sql/drivers/mysql/qsql_mysql.h:128: error: expected ‘;’ before ‘bool’
                                    ../../../sql/drivers/mysql/qsql_mysql.h:136: error: ISO C++ forbids declaration of ‘QMYSQLDriverPrivate’ with no type
                                    ../../../sql/drivers/mysql/qsql_mysql.h:136: error: expected ‘;’ before ‘’ token
                                    ../../../sql/drivers/mysql/qsql_mysql.h:139: error: ‘QT_END_NAMESPACE’ does not name a type
                                    main.cpp:60: error: ‘QMYSQLDriverPlugin’ has not been declared
                                    main.cpp:60: error: ISO C++ forbids declaration of ‘QMYSQLDriverPlugin’ with no type
                                    main.cpp: In function ‘int QMYSQLDriverPlugin()’:
                                    main.cpp:61: error: only constructors take base initializers
                                    main.cpp:63: warning: no return statement in function returning non-void
                                    main.cpp: At global scope:
                                    main.cpp:65: error: expected constructor, destructor, or type conversion before ‘
                                    ’ token
                                    make: *** [main.o] Error 1@

                                    while having path set to
                                    @
                                    export PATH=/home/paul01/QtSDK/Desktop/Qt/4.8.0/gcc/bin:$PATH@

                                    mysqlclient16-dev installed also .

                                    ???
                                    Thanks in advance for help

                                    1 Reply Last reply
                                    0
                                    • S Offline
                                      S Offline
                                      Skyrim
                                      wrote on last edited by
                                      #44

                                      An easy way to create a MySQL driver for Ubuntu 11.04, but the article in the Ukrainian language.
                                      "this":http://aboutqt.blogspot.com/2011/10/mysql-qt-linux.html

                                      1 Reply Last reply
                                      0
                                      • C Offline
                                        C Offline
                                        chandan
                                        wrote on last edited by
                                        #45

                                        Dear it is automatic giving in ubuntu...yesterday day installed it via ububtu software center and when I write the aboe code in console it gives me the followng output..
                                        #include <QtSql>
                                        int main(int argc,char * argv[])
                                        {
                                        QSqlDatabase db;
                                        qDebug()<<db.drivers();
                                        }
                                        just added QT += sql in .pro file
                                        <QSQLITE> <QMYSQL3> <QMYSQL>
                                        hope..it will help full

                                        1 Reply Last reply
                                        0
                                        • I Offline
                                          I Offline
                                          issam
                                          wrote on last edited by
                                          #46

                                          Try OpenSUSE 11.4 and you will never find any problem ! Qt will be installed and well configured with KDE desktop :)

                                          OpenSUSE 11.4 : http://software.opensuse.org/114/en

                                          http://www.iissam.com/

                                          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