Skip navigation links
/ / Up / Table of Contents

User Comments

Posted by Ryan Bates on July 22 2005 3:57pm[Delete] [Edit]

This query will return the name of the current database and NULL if no database is selected.

SELECT DATABASE();

Posted by Robert McCormick on October 19 2006 10:41pm[Delete] [Edit]

To see the list of databases that you can use with the USE command, do

SHOW DATABASES;

Posted by Bruce Daniels on May 7 2008 11:44pm[Delete] [Edit]

If you want to get back to the condition of having no default database then do something like the following:

mysql> CREATE DATABASE SomeWeirdName;
mysql> USE SomeWeirdName;
mysql> DROP SomeWeirdName;

Top / / / Up / Table of Contents