MySQL does not preselect a database for you. Every time we open a new session, we have to specify which database to use.
The way to select a database in MySQL is by using the USE
command.
The steps to selecting a database are as follows:
show databases
" command.
show databases;
To select a database, we type
USE <database_name>;
Example: USE test
;
If we use a database name that does not exist, MySQL throws an error.
To select a database in MySQL workbench, we do the following:
show databases;
USE <database_name>;
Example: USE test
;
The image below all the steps in sequence: