akonadictl: org.kde.pim.akonadiserver: process error: "Unknown error"

This is a wiki page. Be bold and improve it!

If you have any questions about the content on this page, don't hesitate to open a new ticket and we'll do our best to assist you.

Error

When starting akonadictl, we get the following error:

$ akonadictl start
org.kde.pim.akonadiserver: database server stopped unexpectedly
org.kde.pim.akonadiserver: Database process exited unexpectedly during initial connection!
org.kde.pim.akonadiserver: executable: "/usr/sbin/mysqld"
org.kde.pim.akonadiserver: arguments: ("--defaults-file=~/.local/share/akonadi/mysql.conf", "--datadir=~/.local/share/akonadi/db_data/", "--socket=/run/user/1001/akonadi/mysql.socket", "--pid-file=/run/user/1001/akonadi/mysql.pid")
org.kde.pim.akonadiserver: stdout: ""
org.kde.pim.akonadiserver: stderr: ""
org.kde.pim.akonadiserver: exit code: 1
org.kde.pim.akonadiserver: process error: "Unknown error"
org.kde.pim.akonadiserver: Shutting down AkonadiServer...
org.kde.pim.akonadicontrol: Application '/usr/bin/akonadiserver' exited normally...
QFileSystemWatcher::removePaths: list is empty
QFileSystemWatcher::removePaths: list is empty

Possible causes

Apparmor

It may be that apparmor does not give mysqld the necessary permissions to run.

On a Gentoo system, the necessary permissions are set in:

/etc/apparmor.d/mysqld_akonadi

mysql configuration

The error message gives the exact executable name and the arguments used. Try running it manually, to see if you get the same results:

/usr/sbin/mysqld --defaults-file=~/.local/share/akonadi/mysql.conf --datadir=~/.local/share/akonadi/db_data/ --socket=/run/user/1001/akonadi/mysql.socket --pid-file=/run/user/1001/akonadi/mysql.pid

If the command exits immediately, without any output, then check the mysql error log within the data directory. The path is given byn the datadir argument.

Check the configuration file ~/.local/share/akonadi/mysql.conf if log_error is set:

# # error log file name, relative to datadir (default:hostname.err)
log_error=mysql.err

Then monitor the content of the error logs, or tail its output as you try to run mysqld:

$ tail -f ~/.local/share/akonadi/db_data/mysql.err

You may find errors like:
[ERROR] [MY-000067] [Server] unknown variable 'query_cache_size=0'.
[ERROR] [MY-000067] [Server] unknown variable 'log_warnings=2'.

Fix the mysqld configuration accordingly and try again...