lixo1
10th July 2010, 22:05
Dear all,
I just downloaded Qt 4.6.1 installer for windows (VC++ 2008), and I would like to create and use QMYSQL.
I tried all sql examples with QSQLITE and they worked, then I downloaded MySql 5 installer, I built the *.dll qt plugin,
but I can't open/create a new database from scratch.
My code is the following:
QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
db.setUserName("root");
db.setPassword("pass");
db.setDatabaseName("test.mysql"); //I would like to create a new database, locally on my pc
if (!db.open()) return false;
And I'm getting: Unknown database 'test.mysql' QMYSQL: unable to connect.
Any kind of help is appreciated,
Thank you very much.
I just downloaded Qt 4.6.1 installer for windows (VC++ 2008), and I would like to create and use QMYSQL.
I tried all sql examples with QSQLITE and they worked, then I downloaded MySql 5 installer, I built the *.dll qt plugin,
but I can't open/create a new database from scratch.
My code is the following:
QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
db.setUserName("root");
db.setPassword("pass");
db.setDatabaseName("test.mysql"); //I would like to create a new database, locally on my pc
if (!db.open()) return false;
And I'm getting: Unknown database 'test.mysql' QMYSQL: unable to connect.
Any kind of help is appreciated,
Thank you very much.