How to select a database in MySQL?
One way to select (or switch to) a specific database is by using any of the following methods:
Utilize the USE statement:
在 MySQL 命令行界面中,输入 USE database_name;,将 database_name替换为您要选中的数据库名称。
Press the enter key to switch to the specified database.
2. Using the -D or –database parameter in the mysql command-line tool:
In the terminal or command prompt, type mysql -u username -p -D database_name, replacing username with your MySQL username and database_name with the name of the database you want to select.
Press the Enter key and enter the password to switch to the specified database.
Once you have successfully switched to the target database, any subsequent operations you perform on the MySQL command-line interface will be carried out on that database.