On Fri, 25 Mar 2005, Michael Stassen wrote:

> Password hashing was changed in 4.1 to improve authentication security, but
> this complicates backward compatibility.  See the manual for details:
> <http://dev.mysql.com/doc/mysql/en/old-client.html>
> <http://dev.mysql.com/doc/mysql/en/password-hashing.html>
>
> Your best bet is to link your app against the 4.1 client library.

I just tried this.  Or I think I did.  I uninstalled, and
reinstalled mysql v4.1.10a, which I assume has the 4.1
client library.  I recompiled, relinked, and I get the
same error.  Again, I can connect using the mysql CLI, it's
just connecting through the API which is giving me problems.

I can connect to the 4.1.1 server with the mysql CLI, but
only the 4.0 server with the API.  I did have to make one
minor change to the code to get it to recompile.  Is there
some other API issue which I need to be aware of?

The code I use to connect is:


----
  _mysqlconn = mysql_init (NULL);
  if (_mysqlconn == NULL)
    {
      print_error (NULL, "mysql_init() failed (probably out of memory)");
      return -1;
    }

  /* connect to server */
  if (mysql_real_connect (_mysqlconn, host_name, user_name, password,
                          database_name, opt_port_num, opt_socket_name,
                          opt_flags) == NULL)
    {
      print_error (_mysqlconn, "mysql_real_connect() failed");
      mysql_close (_mysqlconn);
      _mysqlconn = NULL;
      return -1;
    }
----

And the failure occurs during mysql_real_connect with error 1045
"Access denied for user:" and not the

"Client does not support authentication protocol requested
 by server; consider upgrading MySQL client"

that the web-page indicates that I might expect.  Again, I
*can* connect with the mysql CLI, it is only from the API
where I'm having difficulty.

Referencing the web page, it appears that the 4.1 server is
using 16-byte passwords, and not the 41-byte passwords.  It
might be that the server was started with --old-passwords
option, but how can I find out if that is the case?

It might be that the API is generating long password values,
when I need short password values.  Can I control this behaviour
through the API?

- Andrew


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to