Documentation Home
MySQL 5.6 リファレンスマニュアル
Download this Manual
PDF (US Ltr) - 26.8Mb
PDF (A4) - 26.9Mb
HTML Download (TGZ) - 7.1Mb
HTML Download (Zip) - 7.2Mb mysql_server_init()

int mysql_server_init(int argc, char **argv, char **groups)


この関数は MySQL ライブラリを初期化します。これは、ほかのすべての MySQL 関数を呼び出す前に実行する必要があります。ただし、mysql_server_init() は非推奨であるため、代わりに、mysql_library_init() を呼び出してください。セクション23.8.7.40「mysql_library_init()」を参照してください。



User Comments
  Posted by Jason Mingl on September 10, 2003
I don't know how often this might come up for others, but here's a tip for those times you have to specify a path for the data directory (or other args) in server_args at runtime.

mysql_server_init apparently does not copy the strings you supply it. It simply makes use of the pointers. Be sure that any string variables you put in place of the server arguments persist throughout your program or some functions may fail. Here's an example:

char Data[] = "--datadir=c:/blah/blah/blah/";

const char *server_args[] =


Now the function ends and the 'Data' var is obliterated. mysql_server_init will execute correctly, but later, in a different function mysql_real_connect will fail mysteriously, claiming it can't find the specified database.

Seems simple, even obvious. I won't mention how long it took me to trace the problem in my program...
Sign Up Login You must be logged in to post a comment.