You could use this SQL:
SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = 'DBName'
In a procedure it would then be something like this:
DECLARE name TEXT;
SELECT SCHEMA_NAME INTO name FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = 'DBName'
IF name = 'DBName' THEN
SIGNAL SQLSTATE '45002'
SET MESSAGE_TEXT = 'This database already exist';
END IF;
(Disclaimer: I haven't written MySQL procedures before and I haven't tested this one. It is only mentioned to give the way of a possible implementation. Also, this example isn't complete.)