The USE statement tells PolarDB-X 1.0 to use the named database as the default database for subsequent operations. This topic describes how to execute the USE statement.

Background information

PolarDB-X 1.0 allows you to connect to different databases that are deployed in a PolarDB-X 1.0 instance. This feature is similar to the feature that enables data queries across standalone databases that run on the MySQL engine. When you log on to a PolarDB-X 1.0 instance, use DB_NAME to configure the default database for subsequent operations. You can execute the USE statement to switch between databases. This helps you manage multiple databases at a time.


  • Before you switch between databases, ensure that you have the permissions on the databases. You can grant the permissions in the console. For more information, see Account and permission system.
  • After you switch to another database, the hints and sequences in original SQL statements take effect on the new database. This rule applies if you do not specify a database in the hints or sequences.


USE db_name   


You can execute the following statement to switch to a database named NEW_DB: