Unable to connect to mariadb database server with qt 4.8.5 and Ubuntu 12.04
I use the following code to connect to a MySQL server database.
Code:
//find mysql driver
db_Server.setHostName("188.**.***.***");
db_Server.setPort(3306);
db_Server.setDatabaseName("Test");
db_Server.setUserName("Test");
db_Server.setPassword("*********");
bool ret = db_Server.open();
if(ret) qDebug() << "Database open"
else qDebug() << db_Server.lastError().text();
Lately they changed the server to mariadb and I assumed it was compatible with QMYSQL driver and used the above code to access the database, but I get the following error
"Can't connect to MySQL server on '188.**.***.***' (101) QMYSQL: Unable to connect"
Is there any additional thing that I need to do with mariadb to connect to the server? Any help is appreciated
I had built the MySQL plugin the following way
#sudo apt-get install libmysqlclient-dev
#cd $QTDIR/src/plugins/sqdrivers/mysql
#sudo qmake “INCLUDEPATH+=usr/include/mysql†“LIBS+=-L/usr/lib/i386-linux-gnu –lmysqlclient_r†mysql.pro
#sudo make
#sudo make install
Should I do any changes for mariadb similarly?
Re: Unable to connect to mariadb database server with qt 4.8.5 and Ubuntu 12.04
It was a problem with the database and not the Qt application, the connection refused if a password was used.