Click to See Complete Forum and Search --> : Checking if database exists


Preoss
April 2nd, 2003, 03:13 PM
I am working on an application that will need to create a database in MySql. I have not been able to find any reference on how to check to see if a database name exists before I go creating it. I did find the syntax CREATE IF NOT EXIST db_name but if I am creating the database for the firs time then I also need to create several tables in the database.

What functions can I call to send the command and get a result letting me know if a database exists?

eduardo7095
April 3rd, 2003, 09:41 AM
Try SHOW DATABASES;

Preoss
April 3rd, 2003, 11:06 AM
What C++ Function do I use to send "SHOW DATABASES;" and how do I get a result back?