Skip to content

Instantly share code, notes, and snippets.

@DAVIDhaker
Last active October 31, 2019 22:00
Show Gist options
  • Save DAVIDhaker/c5496e9063d5c42fe083561668e22414 to your computer and use it in GitHub Desktop.
Save DAVIDhaker/c5496e9063d5c42fe083561668e22414 to your computer and use it in GitHub Desktop.
Snippet for HeidiSQL (and other DB managers)
-- BE ATTENTIVE BEFORE USE!
SELECT DATABASE() INTO @db;
DO
@qdrop := CONCAT("DROP DATABASE `", @db, "`"),
@qcreate := CONCAT("CREATE DATABASE `", @db, "` /*!40100 COLLATE 'utf8mb4_general_ci' */");
PREPARE stmt FROM @qdrop;
EXECUTE stmt;
PREPARE stmt FROM @qcreate;
EXECUTE stmt;
USE @db;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment