install mysql driver for qt in ubuntu

Page  
3

October 9, 2010

doforumda doforumda
Lab Rat
161 posts

well when i run mysql command it says this

  1. the program "mysql" can be found in the following packages:
  2. mysql-client-core-5.1
  3. mysql-client-5.0
  4. mysql-cluster-client-5.1
  5. try sudo apt-get install <selected-package>

which package should i install for creating databse

October 9, 2010

Denis Kormalev Denis Kormalev
Area 51 Engineer
1652 posts

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

October 9, 2010

doforumda doforumda
Lab Rat
161 posts

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

October 9, 2010

Denis Kormalev Denis Kormalev
Area 51 Engineer
1652 posts

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.

October 9, 2010

doforumda doforumda
Lab Rat
161 posts

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.

October 9, 2010

Denis Kormalev Denis Kormalev
Area 51 Engineer
1652 posts

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

October 9, 2010

doforumda doforumda
Lab Rat
161 posts

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??

October 9, 2010

Denis Kormalev Denis Kormalev
Area 51 Engineer
1652 posts

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.

October 10, 2010

doforumda doforumda
Lab Rat
161 posts

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?

October 10, 2010

Denis Kormalev Denis Kormalev
Area 51 Engineer
1652 posts

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

October 10, 2010

doforumda doforumda
Lab Rat
161 posts

can you please check this thread i have some problem in loading mysql driver? Your text to link here… [developer.qt.nokia.com]

February 11, 2012

Pavel Mazniker Pavel Mazniker
Ant Farmer
155 posts

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

  1. ***Unknown option -lmysqlclient_r”

when running

  1. 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 :

  1. paul01@paul01UbInsp:~/QtSDK/QtSources/4.8.0/src/plugins/sqldrivers/mysql$ make
  2. 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
  3. main.cpp:42:30: error: qsqldriverplugin.h: No such file or directory
  4. main.cpp:43:25: error: qstringlist.h: No such file or directory
  5. In file included from main.cpp:47:
  6. ../../../sql/drivers/mysql/qsql_mysql.h:45:30: error: QtSql/qsqldriver.h: No such file or directory
  7. ../../../sql/drivers/mysql/qsql_mysql.h:46:30: error: QtSql/qsqlresult.h: No such file or directory
  8. In file included from main.cpp:47:
  9. ../../../sql/drivers/mysql/qsql_mysql.h:60: error: ‘QT_BEGIN_HEADER’ does not name a type
  10. ../../../sql/drivers/mysql/qsql_mysql.h:70: error: expected class-name before ‘{’ token
  11. ../../../sql/drivers/mysql/qsql_mysql.h:77: error:QVariant’ does not name a type
  12. ../../../sql/drivers/mysql/qsql_mysql.h:84: error:QVariant’ does not name a type
  13. ../../../sql/drivers/mysql/qsql_mysql.h:86: error: ISO C++ forbids declaration of ‘QString’ with no type
  14. ../../../sql/drivers/mysql/qsql_mysql.h:86: error: expected ‘,’ or ‘...’ before ‘&’ token
  15. ../../../sql/drivers/mysql/qsql_mysql.h:89: error:QVariant’ does not name a type
  16. ../../../sql/drivers/mysql/qsql_mysql.h:90: error:QSqlRecord’ does not name a type
  17. ../../../sql/drivers/mysql/qsql_mysql.h:95: error: ISO C++ forbids declaration of ‘QString’ with no type
  18. ../../../sql/drivers/mysql/qsql_mysql.h:95: error: expected ‘,’ or ‘...’ before ‘&’ token
  19. ../../../sql/drivers/mysql/qsql_mysql.h:103: error: expected class-name before ‘{’ token
  20. ../../../sql/drivers/mysql/qsql_mysql.h:104: error: ISO C++ forbids declaration of ‘Q_OBJECT’ with no type
  21. ../../../sql/drivers/mysql/qsql_mysql.h:105: error: expected ‘;’ before ‘friend
  22. ../../../sql/drivers/mysql/qsql_mysql.h:107: error: expected ‘)’ before ‘*’ token
  23. ../../../sql/drivers/mysql/qsql_mysql.h:108: error:QObject’ has not been declared
  24. ../../../sql/drivers/mysql/qsql_mysql.h:110: error: ‘DriverFeature’ has not been declared
  25. ../../../sql/drivers/mysql/qsql_mysql.h:111: error: ISO C++ forbids declaration of ‘QString’ with no type
  26. ../../../sql/drivers/mysql/qsql_mysql.h:111: error: expected ‘,’ or ‘...’ before ‘&’ token
  27. ../../../sql/drivers/mysql/qsql_mysql.h:118: error: ISO C++ forbids declaration of ‘QSqlResult’ with no type
  28. ../../../sql/drivers/mysql/qsql_mysql.h:118: error: expected ‘;’ before ‘*’ token
  29. ../../../sql/drivers/mysql/qsql_mysql.h:119: error:QStringList’ does not name a type
  30. ../../../sql/drivers/mysql/qsql_mysql.h:120: error:QSqlIndex’ does not name a type
  31. ../../../sql/drivers/mysql/qsql_mysql.h:121: error:QSqlRecord’ does not name a type
  32. ../../../sql/drivers/mysql/qsql_mysql.h:122: error:QString’ does not name a type
  33. ../../../sql/drivers/mysql/qsql_mysql.h:124: error:QVariant’ does not name a type
  34. ../../../sql/drivers/mysql/qsql_mysql.h:125: error:QString’ does not name a type
  35. ../../../sql/drivers/mysql/qsql_mysql.h:127: error: expected ‘:’ before ‘Q_SLOTS
  36. ../../../sql/drivers/mysql/qsql_mysql.h:128: error: expected primary-expression before ‘bool
  37. ../../../sql/drivers/mysql/qsql_mysql.h:128: error: ISO C++ forbids declaration of ‘Q_SLOTS’ with no type
  38. ../../../sql/drivers/mysql/qsql_mysql.h:128: error: expected ‘;’ before ‘bool
  39. ../../../sql/drivers/mysql/qsql_mysql.h:136: error: ISO C++ forbids declaration of ‘QMYSQLDriverPrivate’ with no type
  40. ../../../sql/drivers/mysql/qsql_mysql.h:136: error: expected ‘;’ before ‘*’ token
  41. ../../../sql/drivers/mysql/qsql_mysql.h:139: error: ‘QT_END_NAMESPACE’ does not name a type
  42. main.cpp:60: error: ‘QMYSQLDriverPlugin’ has not been declared
  43. main.cpp:60: error: ISO C++ forbids declaration of ‘QMYSQLDriverPlugin’ with no type
  44. main.cpp: In function ‘int QMYSQLDriverPlugin():
  45. main.cpp:61: error: only constructors take base initializers
  46. main.cpp:63: warning: no return statement in function returning non-void
  47. main.cpp: At global scope:
  48. main.cpp:65: error: expected constructor, destructor, or type conversion before ‘*’ token
  49. make: *** [main.o] Error 1

while having path set to

  1. export PATH=/home/paul01/QtSDK/Desktop/Qt/4.8.0/gcc/bin:$PATH

mysqlclient16-dev installed also .

???
Thanks in advance for help

February 15, 2012

Skyrim Skyrim
Hobby Entomologist
38 posts

An easy way to create a MySQL driver for Ubuntu 11.04, but the article in the Ukrainian language.
this [aboutqt.blogspot.com]

April 8, 2012

chandan chandan
Lab Rat
11 posts

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

April 9, 2012

issam issam
Lab Rat
3 posts

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

 Signature 

http://www.iissam.com/

Page  
3

  ‹‹ How to create a Bundle Library (mh_bundle) with qmake on Mac OS X?      Qt library package installer ››

You must log in to post a reply. Not a member yet? Register here!