This is a read-only copy of the MariaDB Knowledgebase generated on 2024-11-15. For the latest, interactive version please visit https://mariadb.com/kb/.

Unknown database 'mysql'

Hey guys i have installed mariadb on arch, started "sudo mysql_secure_installation" but then there was a password required i tried to press enter for empty but it didn't work, after that i tried to run mariadb in safe mode using "sudo mysqld_safe --skip-grant-tables --skip-networking &" but when i tried to use mysql database to reset password there was no database called mysql created by default i got this error "Unknown database 'mysql'" after running "/usr/bin/mysql_install_db" it didn't work as well any idea? even reinstalling didn't solve the issue

Answer Answered by Daniel Black in this comment.

I assume you are following https://wiki.archlinux.org/title/MariaDB.

I can't tell why mysql is "Unknown database".

There's some really horrible recommendations on the wiki in archlinux.

If its a new install, I recommend removing your datadir contents and reinstall with mariadb-install-db --user mysql --skip-test-db, then start MariaDB.

Don't use mysql_secure_installation (skip-test-db covers most of it), and its a less than maintained script.

Create a normal user for yourself with sudo -u mysql mariadb and the CREATE USER with appropriate GRANTS.

Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.