Translation: MariaDB DATABASE (), mariadbdatabase
This document is the description of the official mariadb Manual: DATABASE.
Original article: https://mariadb.com/kb/en/library/database/
Https://mariadb.com/kb/zh-cn/database/ I submitted to the MariaDB official manual
Syntax
DATABASE()
Description
Returns the default (current) database name for a string in utf8 character set format. If no default DATABASE exists, DATABASE () returns NULL. In a stored procedure, the default database is the database associated with the procedure. It can be different from the default database in the context of the calling procedure.
SCHEMA () is a synonym for DATABASE.
You can USE the USE statement to specify the default database. Another way to set the default database is to specify the database name when the mysql command line client starts.
Example
MariaDB [(none)]> SELECT DATABASE();+------------+| DATABASE() |+------------+| NULL |+------------+MariaDB [(none)]> USE testDatabase changedMariaDB [test]> SELECT DATABASE();+------------+| DATABASE() |+------------+| test |+------------+
Go back to the Linux series article outline: workshop!