S
S
sllrod2022-04-08 11:27:52
CentOS
sllrod, 2022-04-08 11:27:52

Deleting db as folders from mariadb?

Good afternoon!

Created a test server some time ago from a backup of the sales, and it looks like the MariaDB databases have been removed just as folders from /var/lib/mysql . For a while everything worked, but the other day after the next launch of the test server, we found that mariadb does not start. When viewing the log, it turned out that mariadb suddenly "remembered" all the previously deleted database folders, and now there is a huge bunch of messages in the log like:

2022-04-08 11:01:38 139848043374784 [ERROR] InnoDB: Operating system error number 2 in a file operation.
2022-04-08 11:01:38 139848043374784 [ERROR] InnoDB: The error means the system cannot find the path specified.
2022-04-08 11:01:38 139848043374784 [ERROR] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.
2022-04-08 11:01:38 139848043374784 [ERROR] InnoDB: Cannot open datafile for read-only: './dbname/tablename.ibd' OS error: 71


When googling, I suddenly came across the fact that everyone is always trying to restore databases with such errors, but on the contrary, I need to get rid of them. And it seems that the server is a test server, and you can re-upload it, but there is one database with specific test data that you don't want to lose...

How to make mariadb forever "forget" about the databases whose folders were deleted?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Akina, 2022-04-08
@Akina

  1. On the problem server:
    • Create database folders.
    • Start the server in recovery mode ( InnoDB Recovery Modes ).
    • Drop bases.

  2. If you can't start even in recovery mode:
    • Restore a database from a backup on another server instance
    • Copy database directories to the problem server
    • See point 1.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question