PDA

View Full Version : using Mysql: Ca't create TCP/IP socket



blackliteon
8th February 2006, 23:41
Trying to create connection, but always see this message
Ca't create TCP/IP socket (10093): QMYSQL unable to connect
Os: WinXP, Qt 4.1, compiler VC.net
set all availible parameters in sql example file:


QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
db.setHostName("localhost");
db.setDatabaseName("qt");
db.setUserName("root");
db.setPassword("xxw22332");
db.setPort(3306);
if (!db.open()) {
QMessageBox::critical(0, qApp->tr("Cannot open database"),
db.lastError().text(), QMessageBox::Cancel,
QMessageBox::NoButton);
return false;
}

connection parameters right.
Try to build mysql plugin from source...
But error everytime.

jacek
8th February 2006, 23:52
Did you add "QT += sql" to your .pro file? Can you connect to MySQL server using the MySQL console?

wysota
9th February 2006, 00:51
db.setPassword("xxw22332");

Never post your passwords anywhere (even if they are fake). Never!

Do you have a firewall running?

crocus
9th February 2006, 01:46
copy libmysql.dll to /system32.
If dont work run /demos/sqlbrowser, if dont work too seache you problem in QMYSQL plugin.

blackliteon
9th February 2006, 08:19
copy libmysql.dll to /system32.
If dont work run /demos/sqlbrowser, if dont work too seache you problem in QMYSQL plugin.

Sqlbrowser can't connect. Write this erro too.
I think too that problem in QMYSQL. and try to build qmysql.dll from source of mysql server on my machine. I remember for testing my localhost apache server + php i set mysql to use OLD_PASSWORD mode. But all mysql clients connect succesfuly to localhost server.

blackliteon
9th February 2006, 10:53
Never post your passwords anywhere (even if they are fake). Never!

Do you have a firewall running?
This is a fake...
But if any ideas what can i Do by hand ?

blackliteon
9th February 2006, 19:25
Hi all!
I just solve my problem with Qt-mysql and now i'll say about it.
So.
I don't know _why_, but when i used mytest.exe from mysql direcory it says me too:
can't connect throw port 3306.
Ok, I'm start
netstat -a
and saw that 3306 port is listening.
And my ems mysql manager connect succesfully!!!!
I try restart service mysql, start it manually... nothing.
So.. decide reinstall mysql
Before my installation path was /program files/mysql/...
now I install it to c:/mysql
allow anonymous to connect,
restart windows....
start mytest.exe -- It works!!!!
try to run qt4.1 sqltable example.. nothing! TCP/IP socket error!!!
Ok, little time ago i rebuild qmysql plugin, and nothing happense, but i want to try one more times..
recompile plugin,,, and
ba-baam!
It works!
So, what happends.... Really I don't know. Maybe because I set OLD_PASSWORD for connecting to server before (i used apache+php4 on localhost)
Thanks to all who try help me.

PS
We dont need to copy libmysql.dll to windows or system32