Previous Page
Next Page

Selecting a Database

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.

New Term

Keyword A reserved word that is part of the MySQL language. Never name a table or column using a keyword. Appendix E, "MySQL Reserved Words," lists the MySQL keywords.


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

Input

USE crashcourse;

Output

Database changed

Analysis

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.

Tip

Using MySQL Query Browser 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 (highlighted in bold) 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.


Previous Page
Next Page