| Bug #75047 | mysql_library_init failure after upgrading mysql | ||
|---|---|---|---|
| Submitted: | 29 Nov 2014 11:11 | Modified: | 19 Feb 2015 20:22 |
| Reporter: | Oliver Foo | Email Updates: | |
| Status: | Not a Bug | Impact on me: | |
| Category: | MySQL Server: Embedded Library ( libmysqld ) | Severity: | S3 (Non-critical) |
| Version: | 5.6.21 | OS: | Linux |
| Assigned to: | CPU Architecture: | Any | |
| Tags: | config, embedded | ||
[29 Nov 2014 14:24]
MySQL Verification Team
related: http://bugs.mysql.com/bug.php?id=39693 (error reporting for mysql_library_init)
[27 Jan 2015 20:37]
Sveta Smirnova
Thank you for the report.
I tried to simplify test case and removed all QT-related parts and could not repeat described behavior. Could you please try my test case and inform if it files in your environment:
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include "mysql.h"
MYSQL *mysql;
int main() {
setenv("MYSQL_HOME", "/home/ssmirnov/blade12/src/bugs", 1);
setenv("DEFAULT_HOME_ENV", "/home/ssmirnov/blade12/src/bugs", 1);
char** mysql_args=new char*[1];
mysql_args[0]="test";
if (int OK = mysql_library_init(1, mysql_args, NULL)) {
printf("Return code: %d, Error: %s", OK, mysql_error(mysql));
exit(OK);
}
mysql = mysql_init(NULL);
}
$cat my.cnf
[embedded]
datadir = /home/ssmirnov/blade12/src/bugs/bug75047
default-storage-engine = MyISAM
loose-innodb = 0
skip-grant-tables = 1
myisam-recover = BACKUP,FORCE
key_buffer_size = 16777216
character-set-server = utf8
collation-server = utf8_bin
[7 Feb 2015 10:20]
Oliver Foo
Thank you for the code example, I've tested it (changed the paths to my db dir) and it works fine with mysql 5.5 and 5.6 on my environment. I guess something in my Qt wrapper or the way CMake compiles my files is wrong , then.
[7 Feb 2015 13:59]
Oliver Foo
I found my problem: It had nothing to do with Qt, but with a missing environment variable: LD_LIBRARY_PATH="/usr/lib64/mysql" when running the Qt application from within Eclipse. I guess the init function simply couldn't find its library.
[19 Feb 2015 20:22]
Sveta Smirnova
Thank you for the feedback. Closing as "Not a Bug".

Description: After upgrading from MySQL 5.5 to 5.6 my embedded MySQL application doesn't start anymore and it doesn't display any useful error messages. How to repeat: Use Sourcecode: QDir qd(QDir::homePath() + "/.test-mysqle"); QByteArray ba = encodeFileName(qd.absolutePath()); setenv("MYSQL_HOME", ba.constData(), 1); setenv("DEFAULT_HOME_ENV", ba.constData(), 1); QVector<const char*> mysql_args; mysql_args << "test"; int ret = mysql_library_init(mysql_args.size(), const_cast<char**>(mysql_args.data()), NULL); if (ret != 0) { qDebug() << "mysql_library_init:" << ret << "Error:" << mysql_error(NULL) << "#" << mysql_errno(NULL); return; } m_db = mysql_init(NULL); if (!m_db) { qDebug() << "mysql_init: Error:" << mysql_error(NULL) << "#" << mysql_errno(NULL); return; } if (mysql_options(m_db, MYSQL_OPT_USE_EMBEDDED_CONNECTION, NULL)) { qDebug() << "mysql_options: Error:" << mysql_error(NULL) << "#" << mysql_errno(NULL); mysql_close(m_db); m_db = NULL; } if (!mysql_real_connect(m_db, NULL, NULL, NULL, NULL, 0, NULL, 0)) { qDebug() << "mysql_real_connect: Error:" << mysql_error(NULL) << "#" << mysql_errno(NULL); mysql_close(m_db); m_db = NULL; return; } And as ~/.test-mysqle/my.cnf: [embedded] datadir = /home/net/.filemanqt-mysqle default-storage-engine = MyISAM loose-innodb = 0 skip-grant-tables = 1 myisam-recover = BACKUP,FORCE key_buffer_size = 16777216 character-set-server = utf8 collation-server = utf8_bin It prints the following error and no more details: mysql_library_init: 1 Error: # 2000 It even prints the same error number if I put an illegal option like "kjvcbdskjds=ckdsjbvds" in the my.cnf file. But it changes to "mysql_embedded: Unknown error 1146" if the file is empty, so it seems to parse the file. Suggested fix: More detailed error numbers and error messages from mysql_error(no).