Determining the Current Database
mysql> mysql> SELECT DATABASE( ); +-------------+ | DATABASE( ) | +-------------+ | test | +-------------+ 1 row in set (0.00 sec)