MySQL Tutorial/Information Functions/DATABASE
DATABASE() returns the default (current) database name.
mysql>
mysql>
mysql> SELECT DATABASE();
+------------+
| DATABASE() |
+------------+
| test |
+------------+
1 row in set (0.00 sec)
mysql>
mysql>
mysql>
mysql> SELECT DATABASE();
+------------+
| DATABASE() |
+------------+
| test |
+------------+
1 row in set (0.00 sec)
mysql>