Home > Database > Mysql Tutorial > body text

Do we need to select the database every time we start a MySQL session? How can this be done?

WBOY
Release: 2023-09-16 13:29:02
forward
1363 people have browsed it

Do we need to select the database every time we start a MySQL session? How can this be done?

The database is only created once, but you need to select it each time you start a MySQL session

. This can be done with the help of the USE db_name statement on the MySQL command line tool.

mysql> Use Query;
Database changed
Copy after login

This indicates that we are now using to query the database.

We can also select the database when calling MySQL from the Windows command line. This can be done with the help of the following command -

C:\Program Files\MySQL\bin>mysql -u root -p query
Enter password: *****
Copy after login

Here, query is the name of the database we will use for the current MySQL session

The above is the detailed content of Do we need to select the database every time we start a MySQL session? How can this be done?. For more information, please follow other related articles on the PHP Chinese website!

source:tutorialspoint.com
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