天天看點

c mysql異常捕獲異常_freebsd c連結mysql時異常

正常的mysql登陸可以正常:

[[email protected] ~/program/c_pro/cLearningFiles/telephone]$ mysql -h mysql -ulzzl -p

Enter password:

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 8628711

Server version: 5.0.41 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

c程式裡面代碼:

if(mysql_real_connect(conn,"mysql","lzzl","**********",NULL,0,NULL,0)==NULL){

printf("Error:%u:%s\n",mysql_errno(conn),mysql_error(conn));

exit(1);

}

if(mysql_query(conn,"create database telephone")){

printf("Error:%u:%s\n",mysql_errno(conn),mysql_error(conn));

exit(1);

}

錯誤資訊為:

Error:1044:Access denied for user 'lzzl'@'192.168.1.%' to database 'telephone'

????