Important: Please read the Qt Code of Conduct -

Old protocol in mysql

  • Hello,

    I am facing a problem when trying to connect from Qt to a database using QMYSQL driver. The connection reports an error:

    Failed to connect to db. "Connection using old (pre-4.1.1) authentication protocol refused (client option 'secure_auth' enabled) QMYSQL: Unable to connect"

    It also appears when using MySQL Workbench. However, I have seen that this error doesn't appear if I add useLegacyAuth=1 to the options of the Workbench connection. Is there a way to set the same option in the Qt code? Or is there any other way to solve this problem?

    I am using Qt 5.1.1 and MySQL Connector C 6.1. The database server is using MySQL 5.1.70-cll.

    Any tip or help would be appreciated.

    Thank you in advance.

  • Hi,

    I think your QMYSQL plugin was built against an OLD libmysqlclient library.
    Have you tried to use a newer one?

  • Hello,

    thank you for your reply. Actually I don't know how to check that. I am new to MySQL and I have compiled the QMYSQL driver with the latest "MySQL Connector" available in their website. For this reason, I was thinking I was using the latest version, but maybe there is something I am missing in between. Could you please tell me how to check the version of libmysqlclient?

    Thank you again.

  • Are you using Windows or Linux?

  • Sorry, I forgot to mention that. I am using Windows 7 and QtCreator.

  • I have the same problem but am using QT5.2. The code works fine when I am testing against a local test database, but fails when I try to run against the live database operated by my ISP who is running the server using MySQL 5.0 which does not support Secure_auth. Since Workbench can be set to run the old connection method surely it should be possible to set the QT plugin similarly, only I can't see how.

Log in to reply