Difference between revisions of "DROP ALL databases in MySQL"

From DevOps Notebook
(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...")
 
(No difference)

Latest revision as of 11:28, 2 June 2023

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');