install mysql driver for qt in ubuntu
Page |
3 |
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.
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?
can you please check this thread i have some problem in loading mysql driver? Your text to link here… [developer.qt.nokia.com]
Yet can’t install according to above.
Why I get
- ***Unknown option -lmysqlclient_r”
when running
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
- In file included from main.cpp:47:
- 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: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: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: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: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
mysqlclient16-dev installed also .
???
Thanks in advance for help
An easy way to create a MySQL driver for Ubuntu 11.04, but the article in the Ukrainian language.
this [aboutqt.blogspot.com]
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
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
You must log in to post a reply. Not a member yet? Register here!




