DROP ALL databases in MySQL

From DevOps Notebook
Revision as of 11:28, 2 June 2023 by MilosZ (talk | contribs) (Created page with "<pre> SET SESSION group_concat_max_len = 1000000; SELECT GROUP_CONCAT( DISTINCT CONCAT('DROP DATABASE ', table_schema, ';') SEPARATOR '' ) FROM information_schema.tables...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
SET SESSION group_concat_max_len = 1000000;

SELECT GROUP_CONCAT(
  DISTINCT CONCAT('DROP DATABASE ', table_schema, ';')
  SEPARATOR ''
)
FROM information_schema.tables
WHERE table_schema NOT IN ('mysql', 'information_schema');