
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
How can we change the default MySQL database to the given 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)
- Related Articles
- How can we check the default character sets of a particular MySQL database?
- How can we drop a MySQL view from the database?
- How can I set a MySQL database to use MyISAM by default?
- How to get the list of tables in default MySQL database?
- How can we delete a MySQL stored function from the database?
- How can we create our own choice MySQL database?
- How can we write PHP script to get the list of MySQL database?
- How can we create user accounts in MySQL database server?
- While connecting to one MySQL database, how can I see the list of tables of other MySQL database?
- How can we delete a MySQL database by using PHP script?
- How can we select a MySQL database by using PHP script?
- How to alter the database engine of a MySQL database table?
- How can we create a table from an existing MySQL table in the database?
- How can we see the list of views stored in a particular MySQL database?
- How can we establish MySQL database by using MySQL binary at command\nprompt?

Advertisements