Bug #57971 mysql_library_init() fails in Embedded server v5.5.6
Submitted: 4 Nov 2010 10:46 Modified: 15 Nov 2010 15:11
Reporter: cedric quilliot Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Embedded Library ( libmysqld ) Severity:S2 (Serious)
Version:v5.5.6 OS:Microsoft Windows (2003 R2 or XP SP3)
Assigned to: Sergey Vojtovich CPU Architecture:Any
Tags: regression
Triage: Triaged: D1 (Critical)

[4 Nov 2010 10:46] cedric quilliot
Description:
I have a program working fine with MySQL v5.1.51 embedded server.
Then I tried to link it against MySQL v5.5.6 rc .

The program fails during library init : mysql_library_init() returns 1, and the error file contains :

InnoDB: The InnoDB memory heap is disabled
InnoDB: Mutexes and rw_locks use Windows interlocked functions
InnoDB: Compressed tables use zlib 1.2.3
101029 15:20:56 InnoDB: highest supported file format is Barracuda.

When the init API is called, it lasts during 5 or 6 seconds, then fails (whereas in earlier releases it starts in less than a second).
The only arguments I pass to mysql_library_init() is the option "--defaults-file=mySql.ini", and my INI file contains only directives "basedir" and "datadir".

How to repeat:
Write a simple init code and link it against libmysqld.dll version 5.5.6, for example :

//////////////////////////////////////////////////////
static char *g_pMySQLOptions[] = {
	"MySqlEmbedded",
	"--defaults-file=mySql.ini",
	NULL
};

int g_nMySQLOptions = sizeof(g_pMySQLOptions) / sizeof(char *) - 1;

static char *g_pMySQLOptionGroups[] = {
	"MySqlEmbedded",
	NULL
};

int main(void)
{
if(mysql_library_init(g_nMySQLOptions, g_pMySQLOptions, (char **) g_pMySQLOptionGroups) != 0)
			{
				printf("Error initializing MySQL Embedded");
				return FALSE;
			} 
}

///////////// Contents of mySql.ini :
[MySqlEmbedded]
#Path to installation directory. All paths are usually resolved relative to this.
basedir="./MySqlBaseDir"

#Path to the database root
datadir="./MySqlDataDir"
default-character-set=latin1

key_buffer_size=64M
[5 Nov 2010 2:24] Miguel Solorzano
Thank you for the bug report.
[11 Nov 2010 13:51] Sergey Vojtovich
In 5.5 there is no "default-character-set" option, thus server refuse to startup.
In 5.1 there is such option with remark that it is deprecated.

You may retrieve relevant error message using mysql_error(NULL).

http://dev.mysql.com/doc/refman/5.5/en/news-5-5-3.html
<quot>
...
Incompatible Change: The following obsolete constructs have been removed. Where alternatives are shown, applications should be updated to use them.
...
The --default-character-set and --default-collation server options (use --character-set-server and --collation-server).
...
</quot>
[15 Nov 2010 13:54] cedric quilliot
Hello,

Thank you very much for this information, now my application works.
However, please note that the documentation is a bit confusing since the option "default-character-set" is still valid for client programs, as mentioned here: 

http://dev.mysql.com/doc/refman/5.5/en/mysql-command-options.html#option_mysql_default-cha...

It should be understood that only the _server_ part of the configuration file no longer accept this option.

Best regards,

Cedric
[15 Nov 2010 15:11] Sergey Vojtovich
The page mentioned above lists _mysql_ command line tool options, not server options.

Server options are listed at:
http://dev.mysql.com/doc/refman/5.5/en/server-options.html#option_mysqld_default-character...

It says explicitly: --default-character-set was removed in MySQL 5.5.3.