How to check if mysql database exists -


is possible check if (mysql) database exists after having made connection.

i know how check if table exists in db, need check if db exists. if not have call piece of code create , populate it.

i know sounds inelegant - quick , dirty app.

select schema_name information_schema.schemata schema_name = 'dbname' 

if need know if db exists won't error when try create it, use (from here):

create database if not exists dbname; 

Comments

Popular posts from this blog

Prolog - Listing -

python - can't seem to get an output from my class -

orchardcms - change base url in local copy in Orchard CMS -