MySQL default schema

Thanks to the "USE" command, I can set the default scheme; Is there a similar command to get the default schema name?

+6
source share
3 answers

SELECT DATABASE(); gotta do the trick. Note that this will return NULL if no schema is currently selected.

+7
source

Mysql provides a function for this:

 SELECT database(); 
+3
source

You may have DBMS status using the STATUS command.

 mysql> STATUS Connection id: Current database: Current user: SSL: Current pager: Using outfile: Using delimiter: Server: Server version: Protocol version: Connection: Server characterset: Db characterset: Client characterset: Conn. characterset: UNIX socket: Uptime: 

DBMS status also has a Current Database parameter.

0
source

Source: https://habr.com/ru/post/897080/


All Articles