Syntax\n------\n\nUSE db_name\n\nDescription\n-----------\n\nThe '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 until another USE statement is issued:\n\n``sql\nUSE db1;\nSELECT COUNT() FROM mytable;   # selects FROM db1.mytable\nUSE db2;\nSELECT COUNT() FROM mytable;   # selects FROM db2.mytable\n`\n\nThe DATABASE() function (SCHEMA() is a synonym) returns the default database.\n\nAnother way to set the default database is by specifying its name when starting the mariadb command line client:\n\n`\nmariadb db1    # starts the mariadb command-line client with db1 as the current database\n`\n\nOne cannot use USE` to a database one has no privileges to. The reason is that a user with no privileges to a database should not be able to know if a database exists or not.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/use-database