Select Databases – Use Database

Select Database

We can create any number of databases in a system and we can use any one of them at a time depending upon our need. In order to see the databases present in the system, we use SHOW command. But one should have admin access to issue this command. It will list all the databases present in the system.

SHOW DATABASES;

Above query will display all the databases our server has as shown below:

Please note that these are not the users. They are all different databases present in the system. Each database will have different users, who have access to login to it.  We can see this in below table, that we have different databases for Students, faculty, exam etc. Each of them of its own set of users and DB objects (only tables are shown below).

We cannot access all database at the same time. If we need to access any particular database, then we have issue command like below:

USE Library; -- library database will become active and it will accept its credentials to login
USE Faculty; -- Faculty database will be active.

When USE command is executed, it activates that particular database, and user can login to the database with their credentials. They can access all the DB objects for which they have access.

Translate »