Problem is when i try to connect to the data base using the CAPI functions it always get connected even if password and user name are incorrect.

I have restricted the access by deleting the NULL user (delete from user where host ='localhost' and user ='') and added the password to the root. it works fine on the command line under windows XP and access is denied to null user and to the root user if password is incorrect.

but it always connected with database if i try to connect it from my code

The code is as follows

mysql_server_init(0,NULL, (char **)server_groups);
MYSQL *mysql=NULL;
mysql =mysql_init(NULL);
if(mysql == NULL)
return false;
mysql_options(mysql, MYSQL_READ_DEFAULT_GROUP, "mydb_libmysqld_CLIENT");
if (!mysql_real_connect(mysql,"localhost","anyuser"," wrongpass","mydb",0,NULL,0))
return false;
return true;