| Bug #67135 | Embedded server does not start with MyISAM as default storage engine | ||
|---|---|---|---|
| Submitted: | 8 Oct 2012 17:44 | Modified: | 1 Nov 2012 16:09 |
| Reporter: | Carlos Quiros | Email Updates: | |
| Status: | Not a Bug | Impact on me: | |
| Category: | MySQL Server: Embedded Library ( libmysqld ) | Severity: | S3 (Non-critical) |
| Version: | 5.5.27 | OS: | Linux (Slackware 14) |
| Assigned to: | CPU Architecture: | Any | |
| Tags: | DEFAULT, engine, libmysqld, myisam, storage | ||
[10 Oct 2012 18:19]
Carlos Quiros
I tested the following server_options in 5.1.66 and 5.5.27:
static char *server_options[] = \
{ (char *)"mysql_test",
(char *)"--datadir=./db",
(char *)"--basedir=./db",
(char *)"--default-storage-engine=MyISAM",
(char *)"--loose-innodb=0",
(char *)"--skip-grant-tables=1",
(char *)"--myisam-recover=FORCE",
(char *)"--key_buffer_size=16777216",
(char *)"--character-set-server=utf8",
(char *)"--collation-server=utf8_bin",
NULL };
libmysqld 5.1.66 is able to start however 5.5.27 is not.
What else is needed in 5.5.x to start the embedded server an override InnoDB?
[12 Oct 2012 17:55]
Sveta Smirnova
Thank you for the report. Looks like your program reads default file somewhere. Please try to add option --no-defaults to option list (note, this option must be first) or explicitly specify which server groups it should read, using solution from http://dev.mysql.com/doc/refman/5.5/en/mysql-library-init.html (search for static char *server_groups[] = {) Let us know if it works.
[13 Oct 2012 12:30]
Carlos Quiros
Hi, I tried your recommendation (--no-defaults as the first option) but I got the same result, however I tried something else.... It turns out that this happens because of changes in the share folder directory. My application supply the share folder from Mysql 5.1.x however its contents have changed substantially from 5.1.66 to 5.5.27. If I replace the contents of share with the newest version the embedded server 5.5.27 starts properly. Without the share folder 5.1.66 nor 5.5.27 will start. Is this an expected behavior? Thanks Carlos.
[1 Nov 2012 16:09]
Sveta Smirnova
Thank you for the feedback. Yes, this is expected behavior: share folder contains files necessary for MySQL Server to run.

Description: Hi, I use to have a program working with the embedded library using the following code: #include <QCoreApplication> #include <mysql.h> #include <QDebug> int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); static char *server_options[] = \ { (char *)"mysql_db", (char *)"--datadir=/home/cquiros/embexample/db", (char *)"--default-storage-engine=MyISAM", (char *)"--loose-innodb=0", (char *)"--skip-grant-tables=1", (char *)"--myisam-recover=FORCE", (char *)"--key_buffer_size=16777216", (char *)"--character-set-server=utf8", (char *)"--collation-server=utf8_bin", NULL }; int num_elements = (sizeof(server_options) / sizeof(char *)) - 1; MYSQL *m_mysql; mysql_library_init(num_elements, server_options, NULL); m_mysql = mysql_init(NULL); qDebug() << "Init passed :-)"; int valopt; valopt = 1; if (mysql_options(m_mysql,MYSQL_OPT_LOCAL_INFILE,(void *)&valopt)) qDebug() << "Error setting option local infile"; mysql_real_connect(m_mysql, NULL,NULL,NULL, "database1", 0,NULL,0); return a.exec(); } However with version 5.5.27 the application returns this error: mysql_embedded: Unknown error 1146 121008 20:22:42 InnoDB: The InnoDB memory heap is disabled 121008 20:22:42 InnoDB: Mutexes and rw_locks use GCC atomic builtins 121008 20:22:42 InnoDB: Compressed tables use zlib 1.2.3 121008 20:22:42 InnoDB: Using Linux native AIO 121008 20:22:42 InnoDB: Initializing buffer pool, size = 128.0M 121008 20:22:42 InnoDB: Completed initialization of buffer pool 121008 20:22:42 InnoDB: Operating system error number 2 in a file operation. InnoDB: The error means the system cannot find the path specified. InnoDB: If you are installing InnoDB, remember that you must create InnoDB: directories yourself, InnoDB does not create them. InnoDB: File name /usr/local/mysql/data/ibdata1 InnoDB: File operation call: 'create'. InnoDB: Cannot continue operation. I am overriding the default storage engine to MyISAM however is does not work. I am not using a my.cnf because I would like the value of datadir to be a input parameter of the application. Do I need to specify some extra parameters in 5.5.27 to make it work? Many thanks, Carlos. How to repeat: You can download the example code from : http://www.qlands.com/other_files/embexample.tar.gz I am using QT 4.xx so its easy to configure where mysqld is. To test it change lines 17 and 19 in embexample.pro to the place where the mysql include and library are and do a qmake. Also change (char *)"--datadir=/home/cquiros/embexample/db", to a valid directory