SQL Query:
SELECT CONCAT('DROP TABLE ', table_schema, '.', table_name, ';') AS 'command' FROM information_schema.tables WHERE table_schema = 'MyDatabaseName' INTO OUTFILE '/tmp/sql_delete_all_tables';
SOURCE /tmp/sql_delete_all_tables;
No access to "/tmp"?
SELECT CONCAT('DROP TABLE ', table_schema, '.', table_name, ';') AS 'command' FROM information_schema.tables WHERE table_schema = 'MyDatabaseName' INTO OUTFILE './sql_delete_all_tables';
SOURCE ./sql_delete_all_tables;
Comments
One Line Mo, 06/01/2020 - 14:11
Befehl um alle Tabellen in Datenbank zu löschen:
SELECT CONCAT('DROP TABLE ', table_schema, '.', table_name, ';') AS 'command' FROM information_schema.tables WHERE table_schema = 'MyDatabaseName' INTO OUTFILE '/tmp/sql_delete_all_tables'; SOURCE /tmp/sql_delete_all_tables;
Man muss Schreibrechte auf /tmp besitzen. Ansonsten kann man ein anderes Pfad auswählen.
Neuen Kommentar schreiben