      qCDebug(AKONADISERVER_LOG) << "Found mysqlcheck: " << mMysqlCheckPath;
  
      mInternalServer = settings.value(QStringLiteral("QMYSQL/StartServer"), defaultInternalServer).toBool();
-@@ -119,7 +110,7 @@ bool DbConfigMysql::init(QSettings &sett
+@@ -119,7 +101,7 @@ bool DbConfigMysql::init(QSettings &sett
      mUserName = settings.value(QStringLiteral("User")).toString();
      mPassword = settings.value(QStringLiteral("Password")).toString();
      mConnectionOptions = settings.value(QStringLiteral("Options"), defaultOptions).toString();

-                                         << QStringLiteral("/opt/mysql/libexec")
-                                         << QStringLiteral("/opt/local/lib/mysql5/bin")
-                                         << QStringLiteral("/opt/mysql/sbin");
     if (defaultServerPath.isEmpty()) {
-        defaultServerPath = XdgBaseDirs::findExecutableFile(QStringLiteral("mysqld"), mysqldSearchPath);
+        defaultServerPath = QStringLiteral(NIXPKGS_MYSQL_MYSQLD);
     }
 
-    const QString mysqladminPath = XdgBaseDirs::findExecutableFile(QStringLiteral("mysqladmin"), mysqldSearchPath);
+    const QString mysqladminPath = QStringLiteral(NIXPKGS_MYSQL_MYSQLADMIN);
     if (!mysqladminPath.isEmpty()) {
 #ifndef Q_OS_WIN
         defaultCleanShutdownCommand = QStringLiteral("%1 --defaults-file=%2/mysql.conf --socket=%3/mysql.socket shutdown")
@@ -99,10 +90,10 @@ bool DbConfigMysql::init(QSettings &sett
 #endif
     }
 

===================================================================
--- akonadi-17.04.0.orig/src/server/storage/dbconfigmysql.cpp
+++ akonadi-17.04.0/src/server/storage/dbconfigmysql.cpp
@@ -63,7 +63,6 @@ bool DbConfigMysql::init(QSettings &sett
     // determine default settings depending on the driver
     QString defaultHostName;
     QString defaultOptions;
-    QString defaultServerPath;
     QString defaultCleanShutdownCommand;
 
 #ifndef Q_OS_WIN
@@ -71,25 +70,8 @@ bool DbConfigMysql::init(QSettings &sett
 #endif
 
     const bool defaultInternalServer = true;
-#ifdef MYSQLD_EXECUTABLE
-    if (QFile::exists(QStringLiteral(MYSQLD_EXECUTABLE))) {
-        defaultServerPath = QStringLiteral(MYSQLD_EXECUTABLE);
-    }
-#endif
-    const QStringList mysqldSearchPath = QStringList()
-                                         << QStringLiteral("/usr/bin")
-                                         << QStringLiteral("/usr/sbin")
