      mCleanServerShutdownCommand = settings.value(QStringLiteral("CleanServerShutdownCommand"), defaultCleanShutdownCommand).toString();
      settings.endGroup();
  
-@@ -196,7 +187,7 @@ bool DbConfigMysql::startInternalServer(
+@@ -129,9 +111,6 @@ bool DbConfigMysql::init(QSettings &sett
+         // intentionally not namespaced as we are the only one in this db instance when using internal mode
+         mDatabaseName = QStringLiteral("akonadi");
+     }
+-    if (mInternalServer && (mMysqldPath.isEmpty() || !QFile::exists(mMysqldPath))) {
+-        mMysqldPath = defaultServerPath;
+-    }
+ 
+     qCDebug(AKONADISERVER_LOG) << "Using mysqld:" << mMysqldPath;
+ 
+@@ -140,9 +119,6 @@ bool DbConfigMysql::init(QSettings &sett
+     settings.setValue(QStringLiteral("Name"), mDatabaseName);
+     settings.setValue(QStringLiteral("Host"), mHostName);
+     settings.setValue(QStringLiteral("Options"), mConnectionOptions);
+-    if (!mMysqldPath.isEmpty()) {
+-        settings.setValue(QStringLiteral("ServerPath"), mMysqldPath);
+-    }
+     settings.setValue(QStringLiteral("StartServer"), mInternalServer);
+     settings.endGroup();
+     settings.sync();
+@@ -196,7 +172,7 @@ bool DbConfigMysql::startInternalServer(
  #endif
  
      // generate config file

===================================================================
--- akonadi-17.04.0.orig/src/server/storage/dbconfigmysql.cpp
+++ akonadi-17.04.0/src/server/storage/dbconfigmysql.cpp
@@ -76,20 +76,11 @@ bool DbConfigMysql::init(QSettings &sett
         defaultServerPath = QStringLiteral(MYSQLD_EXECUTABLE);
     }
 #endif
-    const QStringList mysqldSearchPath = QStringList()
-                                         << QStringLiteral("/usr/bin")
-                                         << QStringLiteral("/usr/sbin")

-                                         << QStringLiteral("/opt/mysql/libexec")
-                                         << QStringLiteral("/opt/local/lib/mysql5/bin")
-                                         << QStringLiteral("/opt/mysql/sbin");
-    if (defaultServerPath.isEmpty()) {
-        defaultServerPath = XdgBaseDirs::findExecutableFile(QStringLiteral("mysqld"), mysqldSearchPath);
-    }
 
-    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 +81,10 @@ bool DbConfigMysql::init(QSettings &sett
 #endif
     }
 
