How do you deselect MySQL database?

前端 未结 3 1498
傲寒
傲寒 2020-12-16 09:51
USE MyDatabase;

How do I UNUSE MyDatabase or DESELECT MyDatabase so I can use SHOW DATABASES again? What is

相关标签:
3条回答
  • 2020-12-16 10:24

    There is no UNUSE. You just select another database and USE it.

    0 讨论(0)
  • 2020-12-16 10:37

    Bruce Daniels presented an answer at https://web.archive.org/web/20160130220207/https://dev.mysql.com/doc/refman/5.5/en/use.html.

    It goes like:

    CREATE DATABASE foofoofooweird;
    USE foofoofooweird;
    DROP DATABASE foofoofooweird;
    

    Et voila, no database is in use.

    To be clear, the hack is to CREATE, USE, then DROP (delete) a temporary placeholder database.
    It is NOT advocating dropping (deleting) any database you actually use!

    All credits to Bruce Daniels!

    0 讨论(0)
  • 2020-12-16 10:39

    MySQL cmd can't make "unuse" function, if you want to change between databases, just use the USE DATABASENAME; command.

    0 讨论(0)
提交回复
热议问题