MariaDB fails to start because mysql.db doesn't exist

# pacman -Sy mariadb
# systemctl enable mariadb
# systemctl start mariadb

But that failed.

# journalctl -xeu  mariadb.service

Gave a hint:

[ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.db' doesn't exist

It turned out that the MySQL system tables and users weren't created. To remedy that, I did:

# mysql_install_db --user=mysql --ldata=/var/lib/mysql

Now, after restarting mariadb, it ran as it should:

# systemctl restart mariadb
# systemctl status mariadb
● mariadb.service - MariaDB 10.8.4 database server
     Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; preset: disabled)
     Active: active (running) since Fri 2022-08-19 12:53:40 CEST; 1s ago

Really strange this is necessary. On CentOS, RHEL, Debian and Ubuntu this is done automatically for you.


~ /home 🏠 ~ talks 💬 ~ bash ~ craftsmanship ~ db ~ dongxi ~ emacs ~ escenic ~ iam ~ java ~ js ~ language ~ latex ~ ldap ~ life ~ linux ~ llm ~ mac-os-x ~ mt-foo ~ network ~ norsk ~ python ~ quotes ~ running ~ security ~ travel ~ unix ~ various ~ vcs ~ webdesign ~ windows ~ discoveries ~ cv 🧙 ~

Licensed under CC BY Creative Commons License ~ 📡 RSS feed ~ ✉ torstein.k.johansen @ gmail ~ 🐘 @skybert@hachyderm.io ~ 🎥 youtube.com/@skybert