Selecting MySQL Database

Selecting MySQL Database

Once you get connected with 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.

Selecting MySQL Database from the Command Prompt

It is very simple to select a database from the mysql> prompt. You can use the SQL command use to select a database.

Example

Here is an example to select a database called TUTORIALS −

[root@host]# mysql -u root -p -h localhost
Enter password:
[mysql]> use mydb
Database changed
[mydb]>

Now, you have selected the TUTORIALS database and all the subsequent operations will be performed on the TUTORIALS database.
NOTE − All the database names, table names, table fields name are case sensitive. So you would have to use the proper names while giving any SQL command.

Drop MySQL Database (Prev Lesson)
(Next Lesson) MySQL – Data Types
', { 'anonymize_ip': true });