USE db_name
The 'USE db_name'
statement tells MariaDB to use the db_name
database as the default (current) database for subsequent statements. The database remains the default until the end of the session or another USE
statement is issued:
USE db1; SELECT COUNT(*) FROM mytable; # selects from db1.mytable USE db2; SELECT COUNT(*) FROM mytable; # selects from db2.mytable
The DATABASE() function (SCHEMA() is a synonym) returns the default database.
Another way to set the default database is specifying its name at mysql command line client startup.
© 2019 MariaDB
Licensed under the Creative Commons Attribution 3.0 Unported License and the GNU Free Documentation License.
https://mariadb.com/kb/en/use/