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

MySQLMySQLi 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)
raja
Published on 19-Feb-2018 07:15:12
Advertisements