Bug #6099 executing mysql_create_db from old api crashes 4.1 + 5.0 server
Submitted: 14 Oct 2004 14:23 Modified: 17 Oct 2004 11:03
Reporter: Georg Richter Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server Severity:S1 (Critical)
Version:>= 4.1 OS:Any (all)
Assigned to: CPU Architecture:Any

[14 Oct 2004 14:23] Georg Richter
Description:
Using (deprecated) function mysql_create_db with 3.23 or 4.0 client library crashes 4.1 and 5.0 
servers :( 
 
Output: 
 
georg@beethoven:~/work/mysql/bugs> ./test 
Error: Lost connection to MySQL server during query 
georg@beethoven:~/work/mysql/bugs> 
Number of processes running now: 0 
041014 16:15:45  mysqld restarted 
 
 

How to repeat:
#include <stdio.h> 
#include <mysql.h> 
 
int main () { 
  MYSQL       *mysql = mysql_init(NULL); 
 
  if (!mysql_real_connect(mysql, "localhost", "root", "", "test", 0, NULL, 0)) { 
      printf("Can't connect! Error: %s\n", mysql_error(mysql)); 
      return 1; 
  } 
 
  mysql_create_db(mysql, "newdb"); 
 
  printf("Error: %s\n", mysql_error(mysql)); 
  mysql_close(mysql); 
}
[14 Oct 2004 14:44] MySQL Verification Team
Back trace:

(gdb) bt
#0  write_db_opt (thd=0x8cbefa8, path=0xbe5ff59c "./newdb/db.opt", create=0x0) at sql_db.cc:251
#1  0x081f9e88 in mysql_create_db (thd=0x8cbefa8, db=0x8ccdd18 "newdb", create_info=0x0, silent=false)
    at sql_db.cc:437
#2  0x0816b43d in dispatch_command (command=COM_CREATE_DB, thd=0x8cbefa8, packet=0x8cc0be1 "newdb",
    packet_length=6) at sql_parse.cc:1571
#3  0x0816aa32 in do_command (thd=0x8cbefa8) at sql_parse.cc:1272
#4  0x0816a007 in handle_one_connection (arg=0x8cbefa8) at sql_parse.cc:1016
#5  0x4017414b in pthread_start_thread () from /lib/libpthread.so.0
#6  0x401741df in pthread_start_thread_event () from /lib/libpthread.so.0
#7  0x402df50a in clone () from /lib/libc.so.6
[17 Oct 2004 11:03] Georg Richter
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. Because of this, we hope you add your comments
to the original bug instead.

Thank you for your interest in MySQL.

Additional info:

duplicate of #6081