freebsd c链接mysql时异常

Posted on 2011-07-20 18:01  xFight  阅读(237)  评论(0编辑  收藏  举报

正常的mysql登陆可以正常:

 

[lzzl@freebsd ~/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'

 

????