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
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)
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!