Zkuste to. Použijte INFORMATION_SCHEMA.SCHEMATA
zkontrolovat existenci databáze
If not exists (SELECT 1
FROM INFORMATION_SCHEMA.SCHEMATA
WHERE SCHEMA_NAME = 'demo-database')
CREATE DATABASE `demo-database`
.....