From: Modestas Vainius <modax@debian.org>
Subject: Force MySQLe to use our custom defaults file
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=673403
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=672207
Origin: vendor
Last-Update: 2012-05-20

Defaults-file is forced via mysql_library_init() command line option
--defaults-file. If this option is not present, mysql_library_init() will also
look for defaults file in the system paths likely making it dependent on the
system-wide MySQL configuration. This causes such side effects like MySQLe
looking for /etc/mysql/conf.d/ or reading system errmsg.sys.

Index: amarok-2.7.1/src/core-impl/collections/db/sql/mysqlecollection/MySqlEmbeddedStorage.cpp
===================================================================
--- amarok-2.7.1.orig/src/core-impl/collections/db/sql/mysqlecollection/MySqlEmbeddedStorage.cpp	2013-05-15 22:46:30.990258000 +0000
+++ amarok-2.7.1/src/core-impl/collections/db/sql/mysqlecollection/MySqlEmbeddedStorage.cpp	2013-05-15 22:46:57.994258000 +0000
@@ -92,8 +92,12 @@
 
     setenv( "MYSQL_HOME", storagePath.toLocal8Bit().data(), 1 );
     setenv( "DEFAULT_HOME_ENV", storagePath.toLocal8Bit().data(), 1 );
-    char *args[] = { (char*) "amarok" };
-    if( mysql_library_init( 1 , args, 0 ) != 0 )
+    QByteArray defaultsFileArg = QByteArray("--defaults-file=") + QFile::encodeName(defaultsFile);
+    char *args[] = {
+        (char*) "amarok",
+        defaultsFileArg.data()
+    };
+    if( mysql_library_init( 2 , args, 0 ) != 0 )
     {
         error() << "MySQL library initialization failed.";
         reportError( "init" );
