Change Default MySQL Database



Suppose currently we are using a tutorial database so it would be 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 subsequent queries.

mysql> USE Sample
Database changed

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

mysql> select database();

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

1 row in set (0.00 sec)
Updated on: 2020-02-05T08:18:09+05:30

463 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements