PDA

View Full Version : [QMYSQL] connection problem


chaos_theory
27th June 2007, 10:46
Hi all!
I'm using QT 4.3.0 and MySQL Server 4.1. I'm trying to build the MySQL plugin using "Building the QMYSQL plugin on Windows using MinGW" tutorial:

http://wiki.qtcentre.org/index.php?title=Building_the_QMYSQL_plugin_on_Wind ows_using_mingw

everything goes fine until step 5: "Run make - this should build the qsqlmysql.dll and libqsqlmysql.a files in the %QTDIR%/plugins/sqldrivers directory." Indeed, running make creates in the %QTDIR%/plugins/sqldrivers some files, but their names are "qsqlmysql4.dll" and "libqsqlmysql4.a". But I guess it's not a big problem, so I copy the libmysql.dll file from the MySQL installation's bin directory to a directory %QTDIR%/bin, and run
the sqlbrowser demo. I can see QMYSQL in the combobox, so i fill blank spaces (database name, username, etc.) to connect - unfortunately i get the message "Can't connect to MySQL server on 'my.host.name' (10061) QMYSQL: Unable to connect". Could anyone help me with that? I think the problem might be in the libqsqlmysql4.a and libqsqlmysqld4.a files - when I open
HKEY_CURRENT_USER\Software\Trolltech\OrganizationD efaults and look into "Qt Plugin Cache 4.3.false" there are two registry keys for libqsqlmysql4.a and libqsqlmysqld4.a files, where values are:

0
1
unknown
2007-06-22T20:19:06

instead of:

40300
0
Windows mingw release full-config
2007-06-19T23:38:29
for other keys (qsqlmysql4.dll and qsqlmysqld4.dll)...any clue? When I install MySQL 5 i don't even see QMYSQL in the combobox...

On the other hand, when I try to connect with mysql at localhost everything works fine (I use 'localhost' as hostname, 'mysql' as database name, 'root' as username and 'password' as password) So i guess there is no problem with QMYSQL plugin. The problem shows when I try to connect with database on another server. I've no idea why :( Has anyone encountered similiar problems? I would appreciate any help!

jacek
27th June 2007, 17:44
On the other hand, when I try to connect with mysql at localhost everything works fine (I use 'localhost' as hostname, 'mysql' as database name, 'root' as username and 'password' as password) So i guess there is no problem with QMYSQL plugin. The problem shows when I try to connect with database on another server.
Did you remember to grant your user right to connect from a remote host?

http://dev.mysql.com/doc/refman/4.1/en/adding-users.html

chaos_theory
28th June 2007, 13:10
Did you remember to grant your user right to connect from a remote host?

http://dev.mysql.com/doc/refman/4.1/en/adding-users.html
Thanks a lot, Jacek!
I guess that was a problem - in the COLUMN_PRIVILEGES table, the GRANTEE option is set to 'user'@'localhost', which means I can access to MySQL database only from this host (am I right?).
Unfortunately, the IS_GRANTABLE option is set to NO, so I'll have to talk to administrator...or connect to host first, and then connect to MySQL database. Thanks again for solving my problem!

chaos_theory
28th June 2007, 13:18
Problem solved:
http://www.qtcentre.org/forum/f-qt-programming-2/t-qmysql-connection-problem-7756.html

jacek
28th June 2007, 17:58
Problem solved:
http://www.qtcentre.org/forum/f-qt-programming-2/t-qmysql-connection-problem-7756.html
Next time, please, don't post the same question in more than one thread.

chaos_theory
2nd July 2007, 10:52
Ok, sorry for that