y setting slave-ddl-exec-mode to STRICT. Dropping an Internal #sql-... Table ----------------------------------- From MariaDB 10.6, DROP TABLE is atomic and the following does not apply. Until MariaDB 10.5, if the mariadbd/mysqld process is killed during an ALTER TABLE you may find a table named #sql-... in your data directory. In MariaDB 10.3, InnoDB tables with this prefix will be deleted automatically during startup. From MariaDB 10.4, these temporary tables will always be deleted automatically. If you want to delete one of these tables explicitly you can do so by using the following syntax: DROP TABLE `#mysql50##sql-...`; When running an ALTER TABLE…ALGORITHM=INPLACE that rebuilds the table, InnoDB will create an internal #sql-ib table. Until MariaDB 10.3.2, for these tables, the .frm file will be called something else. In order to drop such a table after a server crash, you must rename the #sql*.frm file to match the #sql-ib*.ibd file. From MariaDB 10.3.3, the same name as the .frm file is used for the intermediate copy of the table. The #sql-ib names are used by TRUNCATE and delayed DROP. From MariaDB 10.2.19 and MariaDB 10.3.10, the #sql-ib tables will be deleted automatically. Dropping All Tables in a Database --------------------------------- The best way to drop all tables in a database is by executing DROP DATABASE, which will drop the database itself, and all tables in it. However, if you want to drop all tables in the database, but you also want to keep the database itself and any other non-table objects in it, then you would need to execute DROP TABLE to drop each individual table. You can construct these DROP TABLE commands by querying the TABLES table in the information_schema database. For example: SELECT CONCAT('DROP TABLE IF EXISTS `', TABLE_SCHEMA, '`.`', TABLE_NAME, '`;') FROM information_schema.TABLES WHERE TABLE_SCHEMA = 'mydb'; Atomic DROP TABLE ----------------- MariaDB starting with 10.6.1 ---------------------------- From MariaDB 10.6, DROP TABLE for a single table is atomic (MDEV-25180) for most engines, including InnoDB, MyRocks, MyISAM and Aria. This means that if there is a crash (server down or power outage) during DROP TABLE, all tables that have been processed so far will be completely dropped, including related trigger files and status entries, and the binary log will include a DROP TABLE statement for the dropped tables. Tables for which the drop had not started will be left intact. In older MariaDB versions, there was a small chance that, during a server crash happening in the middle of DROP TABLE, some storage engines that were using multiple storage files, like MyISAM, could have only a part of its internal files dropped. In MariaDB 10.5, DROP TABLE was extended to be able to delete a table that was only partly dropped (MDEV-11412) as explained above. Atomic DROP TABLE is the final piece to make DROP TABLE fully reliable. Dropping multiple tables is crash-safe. See Atomic DDL for more information. Examples -------- DROP TABLE Employees, Customers; Notes ----- Beware that DROP TABLE can drop both tables and sequences. This is mainly done to allow old tools like mariadb-dump (previously mysqldump) to work with sequences. URL: https://mariadb.com/kb/en/drop-table/https://mariadb.com/kb/en/drop-table/