Home > Database > Mysql Tutorial > What does the user default MySQL database mean?

What does the user default MySQL database mean?

WBOY
Release: 2023-08-24 09:09:11
forward
1439 people have browsed it

用户默认的 MySQL 数据库是什么意思?

Actually, users do not have a default database. But we have the default database for the current session. As can be seen from the following query -

mysql> Select Database();
+------------+
| Database() |
+------------+
| sample     |
+------------+
1 row in set (0.00 sec)
Copy after login

The above result set shows that we are currently using the "sample" database. It is set for the current session. We can set up another database for the current session with the help of USE statement as shown below -

mysql> USE query;
Database changed

mysql> Select Database();
+------------+
| Database() |
+------------+
| query      |
+------------+
1 row in set (0.00 sec)
Copy after login

Now, "query" will become the default database for the current session.

The above is the detailed content of What does the user default MySQL database mean?. 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