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

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 −


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

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

Updated on: 20-Jun-2020


Kickstart Your Career

Get certified by completing the course

Get Started