I guess this is a problem with the version of the C client Libraries that you are using, because of the way 4.1.x version of mysql stores the hash value of the password using the PASSWORD( ) function, so when you are giving the password embedded in the C code, may be the server does not match it with the one stored byt it , you could try two things i guess as per the
1) Upgrade all client programs to use the 4.1.1 or newer client library. Reset the user that needs a pre-4.1 client to use an old password: mysql> UPDATE user SET Password = OLD_PASSWORD('mypass') -> WHERE Host = 'some_host' AND User = 'some_user'; mysql> FLUSH PRIVILEGES; OR 2) Tell the server to use the older password hashing algorithm: Start mysqld with --old-passwords. Set the password for all users that has a long password. You can find these users with: SELECT * FROM mysql.user WHERE LEN(password) > 16; http://dev.mysql.com/doc/mysql/en/password-hashing.html Hope this helps .... Kishore Jalleda On 6/23/05, Elizabeth Bonifacio <[EMAIL PROTECTED]> wrote: > Dear All, > > I'm new into mysql and has been encountering huge problem in > connecting to the database from the c application. The code execute > with an error message : > Failed to connect to database: Error: > Client does not support authentication protocol requested by server; > consider upgrading MySQL client > Is this a bug? > > I'm running the MySql server version 4.1 with server and client both > on same computer running on windows XP. > > I have no problem connecting to the server using root with a windfall > password but I cannot connect from the c application below. > > I have only one user in the server (root,windfall) and has been > successful in accessing mysql from the client side except when > connecting from a c application. > > here is the application which I compile using Visual C++ compiler: > > #include "stdio.h " > #include "winsock.h" > #include "iostream.h " > > #include "mysql.h" > > int main() > { > > MYSQL mysql; > MYSQL_ROW row; > MYSQL_RES *result; > > unsigned int num_fields; > unsigned int i; > int num = 0; > int iRetValue = 0; > > mysql_init(&mysql); > //printf("%s",&mysql ); > > if (!mysql_real_connect(&mysql,"localhost","root","windfall","mysql",3306, > NULL,0)) > { > fprintf(stderr, "Failed to connect to database: Error: \n%s\n", > mysql_error(&mysql)); > } > else > { > printf("SUCCESS\n"); > iRetValue = mysql_query(&mysql, "SELECT * FROM user"); > > if( iRetValue != 0 ) > { > printf("Query Not Executed Properly.Please Check The Syntax.\n"); > } > //here goes the error message :o) > else > { > result = mysql_store_result(&mysql); > > num = mysql_field_count(&mysql); > printf("Number Of Rows :%d\n",num ); > > num_fields = mysql_num_fields( result); > printf("Number Of Coloumns :%d\n",num_fields ); > > while ((row = mysql_fetch_row(result))) > { > unsigned long *lengths; > lengths = mysql_fetch_lengths(result); > > for(i = 0; i < num_fields; i++) > { > printf("[%.*s] \t", (int) lengths[i], row[i] ? row[i] : "NULL"); > } > printf("\n"); > } > } > } > } > > I would appreciate if you guys can help. thanks. > > Elizabeth > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] > > -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]