Home > Database > Mysql Tutorial > body text

How can we change the default MySQL database to a given database?

WBOY
Release: 2023-09-04 10:53:02
forward
582 people have browsed it

我们如何将默认的 MySQL 数据库更改为给定的数据库?

Assuming we are currently using a tutorial database, then it will become the default MySQL database for subsequent queries. Now, with the help of USE db_name statement, we can change the default database to other given database for subsequent queries.

mysql> USE Sample
Database changed
Copy after login

The database has been changed from tutorial to example. To verify this we can run the following command −

mysql> select database();

+------------+
| database() |
+------------+
| sample     |
+------------+

1 row in set (0.00 sec)
Copy after login

The above is the detailed content of How can we change the default MySQL database to a given database?. 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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!