From: Elizabeth Bonifacio Date: June 22 2005 10:07am Subject: help to connect from c application List-Archive: http://lists.mysql.com/plusplus/4555 Message-Id: <453df8d005062203076ff7f911@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable I'm new into mysql and has been encountering huge problem in connecting to the database from the c application. Error message is: Failed to connect to database: Error: Client does not support authentication protocol requested by server; consider upgrading MySQL client Press any key to continue here is the application: #include "stdio.h "=20 #include "winsock.h"=20 #include "iostream.h " #include "mysql.h" int main() {=20 MYSQL mysql;=20 MYSQL_ROW row;=20 MYSQL_RES *result;=20 unsigned int num_fields;=20 unsigned int i;=20 int num =3D 0; int iRetValue =3D 0; mysql_init(&mysql);=20 //printf("%s",&mysql ); if (!mysql_real_connect(&mysql,"localhost","sampadm","secret","sampdb",3306= , NULL,0)) {=20 fprintf(stderr, "Failed to connect to database: Error: \n%s\n",=20 mysql_error(&mysql));=20 }=20 else=20 {=20 printf("SUCCESS\n"); iRetValue =3D mysql_query(&mysql, "SELECT * FROM user"); if( iRetValue !=3D 0 ) { printf("Query Not Executed Properly.Please Check The Syntax.\n"); } //here goes the error message :o)=20 else {=20 result =3D mysql_store_result(&mysql); num =3D mysql_field_count(&mysql); printf("Number Of Rows :%d\n",num ); num_fields =3D mysql_num_fields( result); printf("Number Of Coloumns :%d\n",num_fields ); while ((row =3D mysql_fetch_row(result)))=20 {=20 unsigned long *lengths;=20 lengths =3D mysql_fetch_lengths(result);=20 for(i =3D 0; i < num_fields; i++)=20 {=20 printf("[%.*s] \t", (int) lengths[i], row[i] ? row[i] : "NULL");=20 }=20 printf("\n");=20 }=20 }=20 } }=20 I would appreciate if you guys can help. thanks. Elizabeth