Bug 367075 - Initial database creation fails.
Summary: Initial database creation fails.
Status: RESOLVED FIXED
Alias: None
Product: Akonadi
Classification: Frameworks and Libraries
Component: server (show other bugs)
Version: 5.2.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-08-17 07:07 UTC by Nat
Modified: 2016-09-14 13:32 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In: 16.12.0


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nat 2016-08-17 07:07:27 UTC
Akonadi fails to create database on first start.
MySQL back end is MariaDB.

Reproducible: Always

Steps to Reproduce:
1. Delete all akonadi config/data files in home directory.
2. Start Akonadi Console
3. Start/Restart Server

Actual Results:  
Akonadi server fails to start.

Errors:
[Warning] Failed to open optimizer cost constant tables
[ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
[ERROR] Aborting


Expected Results:  
Akonadi server starts successfully. 

I traced down the problem to mysql_install_db failing, turns out it needs an extra parameter, "--basedir=/usr" to find helper files.

It starts normally after applying this patch I made (the extra search path is probably not relevant) :

diff -crB akonadi-16.04.3-orig/src/server/storage/dbconfigmysql.cpp akonadi-16.04.3/src/server/storage/dbconfigmysql.cpp
*** akonadi-16.04.3-orig/src/server/storage/dbconfigmysql.cpp	2016-08-17 13:48:59.195381646 +0900
--- akonadi-16.04.3/src/server/storage/dbconfigmysql.cpp	2016-08-17 13:53:12.706308135 +0900
***************
*** 78,83 ****
--- 78,84 ----
  #endif
      const QStringList mysqldSearchPath = QStringList()
                                           << QStringLiteral("/usr/sbin")
+                                          << QStringLiteral("/usr/bin")
                                           << QStringLiteral("/usr/local/sbin")
                                           << QStringLiteral("/usr/local/libexec")
                                           << QStringLiteral("/usr/libexec")
***************
*** 501,506 ****
--- 502,508 ----
      return 0 == execute(mMysqlInstallDbPath,
                          { QStringLiteral("--defaults-file=%1").arg(confFile),
                            QStringLiteral("--force"),
+                           QStringLiteral("--basedir=/usr"),
                            QStringLiteral("--datadir=%1/").arg(dataDir) });
  }
Comment 1 Daniel Vrátil 2016-09-14 13:32:17 UTC
Git commit 37c639a158f78b810e84c84a9c42b6b63571c447 by Daniel Vrátil.
Committed on 14/09/2016 at 13:31.
Pushed by dvratil into branch 'master'.

Pass --basedir to mysql_install_db

Based on patch from https://bugs.kde.org/367075
FIXED-IN: 16.12.0

M  +12   -0    src/server/storage/dbconfigmysql.cpp

http://commits.kde.org/akonadi/37c639a158f78b810e84c84a9c42b6b63571c447