Do you fail with a user who has a password? >>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<<
On 2/17/04, 3:11:44 PM, Cira Account <[EMAIL PROTECTED]> wrote regarding Can't connect using C API: > I apologize if the listings below are badly > formatted. I am posting this from a webmail client > and it has very short line lengths. > I am using MySQL 4.0.17 on QNX 6.2.0. I can connect > by typing "mysql -u root" from the command line. > However, I get: > Database connect failed > Can't connect to local MySQL server through > socket '' (261) (2002) > when I run this program: > #include <stdio.h> > #include <mysql/mysql.h> > int main(int argc, char *argv[]) > { > MYSQL mysql; > if (!mysql_init(&mysql)) > { > fprintf(stderr, "mysql_init failed\n"); > } > else if (!mysql_real_connect(&mysql, > "localhost", "root", "", "qsbr", 0, "", > 0) ) > { > fprintf(stderr, "Database connect failed\n"); > fprintf(stderr, "%s (%d)\n", mysql_error(&mysql), > mysql_errno(&mysql)); > } > #if 0 > else > { > int error = mysql_query(&mysql, > "select * from packet where date_add(timestamp, " > "interval 15 second) < now() order by priority > desc, timestamp;"); > fprintf(stdout, "error = %d\n", error); > } > #endif > return(0); > } > -- > 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]