- 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
After connecting to MySQL server how can we select a database fromncommand 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 mysql>
Now, we have selected the TUTORIALS database and all the subsequent operations will be performed on the TUTORIALS database.
- Related Articles
- How can we analyze the tables of a particular database from MySQL Server command line?
- Connecting to MySQL database from the command line?
- How can we get the list of tables in a particular database from MySQL Server command line?
- Command Options for Connecting to the MySQL Server
- Connecting to the MySQL Server Using Command Options
- Print structured MySQL SELECT at command prompt
- How can we create user accounts in MySQL database server?
- Connecting to and Disconnecting from the MySQL Server
- How can we select a MySQL database by using PHP script?
- How to upgrade MySQL server from command line?
- How can we establish MySQL database by using MySQL binary at command\nprompt?
- How can we return to windows command shell from MySQL command line tool?
- How to run a PowerShell script from the command prompt?
- How can we drop a MySQL view from the database?
- What is MySQL CREATE command? How can we create both database and table with this command?