Select Database (USE Command)

When you first connect to MySQL, you do not have any databases open for use. Before you can perform any database operations, you need to select a database. To do this you use the USE keyword.

For example, to use the testdb database you would enter the following:

USE testdb;

After entering the above command you'll see the following result:

Database changed

The USE statement does not return any results. Depending on the client used, some form of notification might be displayed. For example, the Database changed message shown here is displayed by the mysql command-line utility upon successful database selection.

In MySQL Query Browser, double-click on any database listed in the Schemata list to use it. You'll not actually see the USE command being issued, but you will see the database selected and the application title bar will display the name of the selected database.

Remember, you must always USE a database before you can access any data in it.