How to See Which MySQL Database Is Currently Selected?

You can find out which MySQL database is currently selected by using the DATABASE() function, for example, like so:


If no database is selected, it will return NULL, otherwise it will produce an output like the following:

| db_name    |

Hope you found this post useful. It was published . Please show your love and support by sharing this post.