Hello.
Are you sure that mysql.exe is the same version as the server? Check if you're able to connect to 3.23.xx server using API. What value does your MYSQL_SECURE_AUTH option have? See: http://dev.mysql.com/doc/mysql/en/mysql-options.html Nicholas Watmough <[EMAIL PROTECTED]> wrote: > I am have trouble connecting to the MySQL server 4.1 using the API, > though I have no trouble connecting using the same parameters from the > command line mysql.exe. > > I'm using server version 4.1.10 on Windows Server 2003, which was > started with --old-password (to ensure back compatibility with legacy > PHP 4 applications). As a result my mysql server uses the older style, > 16-bit password hashing. > > I'm using mysql_real_connect, and linking with the libmysql.lib that > ships with ver 4.1.10. > > When I connect using mysql_real_connect() to a database with a password, > it fails, and returns a "bad handshake" error. > However, when I connect using mysql_real_connect() to a database with no > password, it connects without a problem. > > This makes me suspect that the client is incorrectly trying to hash with > the newer style 41-bit hashing, against a server using the 16-bit > hashing. Is there any way to tell the client to use older-style hashing? > One of the client flags seems to relate to this, > ie: > #define CLIENT_LONG_PASSWORD 1 /* New more secure passwords */ > (mysql_com.h, line 107) > > but this should mean that a value of 0 uses short passwords, and I'm > calling mysql_real_connect with a value of 0 for the client flag > argument (though I've also tried with 1 to see if that works). > > I have no trouble connecting to the database using the same connection > parameters using the command line mysql.exe. > > Do anyone have any idea what I should do? > > > *** code extract *** > > MYSQL my; > > mysql_init(&my); > > if (!mysql_real_connect(&my, host, user, password, db, port, NULL, 0)) > { > cerr << ... > exit(EXIT_FAILURE); > } > else > { > cerr << ... > exit(EXIT_SUCCESS); > } > -- For technical support contracts, goto https://order.mysql.com/?ref=ensita This email is sponsored by Ensita.NET http://www.ensita.net/ __ ___ ___ ____ __ / |/ /_ __/ __/ __ \/ / Gleb Paharenko / /|_/ / // /\ \/ /_/ / /__ [EMAIL PROTECTED] /_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.NET <___/ www.mysql.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]