This topic describes how to use the USE command to change the default database to which your session is connected in the PolarDB-X.

Background information

PolarDB-X allows you to connect to different databases that are deployed in the same PolarDB-X instance. This way, you can use data queries in a similar manner as those performed across standalone databases that run MySQL. When you log on to a PolarDB-X instance, use DB_NAME to configure the default database to perform operations. You can execute the USE statement to change the default database. This helps you manage multiple databases at the same time.

Syntax

USE db_name   

Examples

You can execute the following statement to change the default database to the NEW_DB database:

USE NEW_DB