Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
If MySQL is installed, Akonadi doesn't work anymore. This is a possible workaround to get Akonadi back to work.

Akonady and MySQL bug

Table of Contents

Link to the bug on Launchpad

Bug on Launchpad.

Situation

In my tests I noticed that Akonadi and all the PIM suite Kontact work fine until you do not install a MySQL server (for example, for a local LAMP server). As soon as I install the MySQL server, Akonadi stops working.

If you read the messages during the installation of MySQL server, you read something like:

Preconfiguring packages ...
dpkg: mariadb-client-core-10.3: dependency problems, but removing anyway as you requested:
 akonadi-backend-mysql depends on mariadb-client-core-10.3 | virtual-mysql-client-core; however:
  Package mariadb-client-core-10.3 is to be removed.
  Package virtual-mysql-client-core is not installed.
  Package mariadb-client-core-10.3 which provides virtual-mysql-client-core is to be removed.

So, a fundamental part of Akonadi is removed, i.e. akonadi-backend-mysql.

Once akonadi-backend-mysql is removed, Akonadi (and all the PIM suite Kontact) doesn't work anymore.

This is very strange, because Akonadi should have its own local MySQL server (unless configured otherwise), as said in the KDE TechBase.

Akonadi should work fine both having MySQL server installed and not.

Aa a workaround, I am using the following for the moment.

Workaround

Since the installation of MySQL server removed akonadi-backend-mysql, we should tell Akonadi to use the MySQL server instead of akonadi-backend-mysql, as said in the KDE TechBase.

Editing Akonadi configuration file

Note. The word USER must be changed to the current system username. If you login into Linux with john, then change USER with john.

Open the file /home/USER/.config/akonadi/akonadiserverrc. We should have something like this:

[%General]
Driver=QMYSQL

[QMYSQL]
Host=
Name=akonadi
Options="UNIX_SOCKET=/run/user/1000/akonadi/mysql.socket"
ServerPath=/usr/sbin/mysqld-akonadi
StartServer=true

Change it in this way:

[Debug]
Tracer=null

[%General]
Driver=QMYSQL

[QMYSQL]
Host=localhost
Name=akonadi
Options="UNIX_SOCKET=/var/run/mysqld/mysqld.sock"
ServerPath=/usr/sbin/mysqld
StartServer=false

Save and exit the editor.

Add your standard system user to MySQL

In the terminal type:

sudo mysql

and then in MySQL prompt (change USER with your username.):

CREATE USER 'USER'@'localhost' IDENTIFIED WITH auth_socket;

Please note that the username USER is the same as the standard user in your system. Akonadi will use USER as username to connect to MySQL via auth_socket.

Do not exit from MySQL prompt because we will do other operations.

Create the "akonadi" database

In MySQL prompt:

CREATE DATABASE akonadi;

Give USER the privileges on database "akonadi"

In MySQL prompt (change USER with your username.):

GRANT ALL PRIVILEGES ON akonadi.* TO 'USER'@'localhost';

Then:

FLUSH PRIVILEGES;

Then exit from MySQL prompt:

exit

Try to start Akonadi

In the Bash prompt:

akonadictl start

Akonadi should start correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment