Home > Database > Mysql Tutorial > How do we select the database from the command prompt after connecting to the MySQL server?

How do we select the database from the command prompt after connecting to the MySQL server?

王林
Release: 2023-09-02 12:17:02
forward
1525 people have browsed it

连接到 MySQL 服务器后,我们如何从命令提示符中选择数据库?

#Once we connect to the MySQL server, we need to select the database we want to use. This is because the MySQL server may have multiple databases available.

Selecting a database from the mysql> prompt is very simple. We can use the SQL command "use" to select the database. To illustrate this, we select the database named "Tutorials" in the following example -

Example

[root@host]# mysql -u root -p
Enter password:******
mysql> use TUTORIALS;
Database changed
mysql>
Copy after login

Now that we have selected the TUTORIALS database, the following All operations will be performed on the TUTORIALS database.

The above is the detailed content of How do we select the database from the command prompt after connecting to the MySQL server?. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template