THE WORLD'S LARGEST WEB DEVELOPER SITE

MySQL DATABASE() Function

❮ MySQL Functions

Example

Return the name of the default database:

SELECT DATABASE();
Try it Yourself »

Definition and Usage

The DATABASE() function returns the name of the default database.

If there is no default database, the DATABASE() function will return NULL (from MySQL 4.1.1) or "" (prior to MySQL 4.1.1).

Note: The DATABASE() function uses the UTF8 character set (from MySQL 4.1).

Syntax

DATABASE()

Technical Details

Works in: MySQL 5.7, MySQL 5.6, MySQL 5.5, MySQL 5.1, MySQL 5.0, MySQL 4.1, MySQL 4.0.6

❮ MySQL Functions