After connecting to MySQL server how can we select a database from command prompt?

MySQLMySQLi Database

Once we get connected to the MySQL server, it is required to select a database to work with. This is because there might be more than one database available with the MySQL Server.

It is very simple to select a database from the mysql> prompt. We can use SQL command ‘use’ to select a database. To illustrate it we are selecting the database named ‘Tutorials’ in the following example −

Example

[root@host]# mysql -u root -p
Enter password:******
mysql> use TUTORIALS;
Database changed
mysql>

Now, we have selected the TUTORIALS database and all the subsequent operations will be performed on the TUTORIALS database.

raja
Published on 21-Feb-2018 06:23:33
Advertisements