PDA

View Full Version : MySQL and qt



kernel_panic
2nd February 2007, 13:13
hello all!

i've got a problem with connecting to a mysql database.

i call


QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");

db.setHostName("127.0.0.1");
db.setDatabaseName("blabla");
db.setUserName("root");
db.setPassword("1234567");
db.setPort(3007);
bool ok = db.open();
if(!ok)
QMessageBox::information(0,
tr("Datenbankfehler"),
sksdatabase.lastError().text());




but i get this error:quote:


Cannot Connect to MySQL Server on 127.0.0.1(10061) QMYSQL:unable to connect

the server is set up with my parameters, what can i do?

Lykurg
2nd February 2007, 19:16
[...]

db.setPort(3007);
[...]
the server is set up with my parameters, what can i do?

Sorry, but is your mysql-server really accessable under port 3007. Isn't it normaly 3306?

Lykurg

kernel_panic
5th February 2007, 07:31
all is set up with my parameters.
i really don't know why qt can't connect

wysota
5th February 2007, 09:13
If you're using Unix, what does "netstat -lp | grep 3007" return?

kernel_panic
5th February 2007, 10:17
i've solved my problem. thanks for help