I have a big problem and i tried to fix this since weeks. After 1-2 days i lost the database "mysql" in MariaDB (Server version: 10.5.12-MariaDB MariaDB package) running on OpenSuSe Leap 15.3. Only the client database (but without more tables) and the database "information_shema" exists. Database "mysql" not more exists. I need to reinstall the database server, set all the passwords, etc., import the database from a backup and all works fine, but after one day, more ore less, the database "mysql" is not more. Also the folder "/var/lib/mysql" contains only the folder of my clients database and of "information_shema". Only the user "root" have access to the database server and only with password. Every day i run a backup of the databases, but i have now no more idea how this is posible. I changed all passwords for the reason it is not hacked, but always the same result. Have someone an idea? Many thanks in advance for your help!

  • 1
    Sounds like something or someone on your server is deleting /var/lib/mysql/mysql. MariaDB won't do this spontaneously. Sep 6, 2021 at 18:47
  • 1
    If the database is used by a web server, then confirm that it's not using the root SQL account and search your web server logs for something that looks like a SQL injection 🤐
    – matigo
    Sep 7, 2021 at 0:57
  • Thanks a lot@all! Sep 7, 2021 at 19:14

1 Answer 1


As others have mentioned, the mysql database doesn't spontaneously disappear from MariaDB. Check for SQL injection in your logs. As best practice however, I recommend you to create a user specifically for the application connecting to the database.

CREATE USER appuser IDENTIFIED BY 'password'

If the application is running on the same machine, you can restrict external access like so:

CREATE USER appuser@localhost;

Then, grant the application user access only to the application database(s).

GRANT ALL ON app_database.* to appuser;

Or if you created the user with the host database:

GRANT ALL ON app_database.* to appuser@localhost;

Worst case scenario now is that an SQL injection will only expose the application database, not the server's user passwords. As always, remember little Bobby tables.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.