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
Post a Comment