MySQL: determine which database is selected?

后端 未结 8 1273
失恋的感觉
失恋的感觉 2020-12-02 05:19

After calling mysql_select_db to grab a database, is there any way to later output the name of the database that is currently selected? This seems very basic bu

8条回答
  •  广开言路
    2020-12-02 05:31

    SELECT DATABASE();
    

    p.s. I didn't want to take the liberty of modifying @cwallenpoole's answer to reflect the fact that this is a MySQL question and not an Oracle question and doesn't need DUAL.

提交回复
热议问题