[Qt-interest] Qt 4.5.0: MySQL plugin can't connect to DB

Robert Hairgrove evorgriahr at hispeed.com
Tue Mar 31 11:10:39 CEST 2009


Stephen Collyer wrote:
> I've built Qt 4.5.0 with the MySQL plugin against MySQL 5.1 under Vista 
> with SP1.
> 
> The following code:
> 
> int main (int argc, char *argv[])
> {
>     QCoreApplication qapp(argc, argv);
>     qDebug() << QSqlDatabase::drivers();
> }
> 
> reports:
> 
> ("QSQLITE", "QMYSQL3", "QMYSQL")
> 
> which, I assume, tells me that Qt can find that set of plugins.
> 
> If I try to connect to a MySQL DB I get:
> 
> Can't connect to MySQL server on 'localhost' (10061) QMYSQL: Unable to 
> connect
> 
> I can connect correctly using the mysql command line tool to the DB in 
> question,
> with the appropriate user/password.
> 
> Can anyone suggest what may be the problem here ? I can't see anything 
> related
> in task tracker, but I can't see what I can have screwed up myself either.
> 
> --
> 
> Stephen Collyer

Did you also set the correct port before trying to connect? For 
localhost, this would usually be 3306.

Maybe you could post the minimum code you are using to connect?



More information about the Qt-interest-old mailing list