
- 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
How to create a database on command line in MySQL?
First, you need to open the command prompt. You can open using shortcut windows+R key.
The screenshot is as follows −
Now type CMD and press OK button −
Now the following command prompt would be visible −
Now reach the MySQL bin directory. The screenshot is as follows −
Following is the query to run MySQL in the command line to create a database −
Now you can check the database is created or not using SHOW DATABASES command −
mysql> SHOW DATABASES;
This will produce the following output −
+---------------------------+ | Database | +---------------------------+ | bothinnodbandmyisam | | business | | commandline | | customer_tracker_database | | customertracker | | database1 | | databasesample | | demo | | education | | hb_student_tracker | | hello | | information_schema | | javadatabase2 | | javasampledatabase | | login | | mybusiness | | mydatabase | | mysql | | onetomanyrelationship | | onlinebookstore | | performance_schema | | rdb | | sample | | sampledatabase | | schemasample | | sys | | test | | test3 | | tracker | | universitydatabase | | web | | webtracker | +---------------------------+ 32 rows in set (0.00 sec)
- Related Articles
- Connect to MySQL database from command line
- Connecting to MySQL database from the command line?
- How to open MySQL command line on Windows10?
- What is MySQL CREATE command? How can we create both database and table with this command?
- How to display the value of a variable on command line in MySQL?
- MySQL query to discover current default database collation (via command line client)?
- How can we analyze the tables of a particular database from MySQL Server command line?
- Oracle DataBase – Grant Privileges to a User in SQL Command Line
- How to generate a “create table” command based on an existing table in MySQL?
- How can we get the list of tables in a particular database from MySQL Server command line?
- How do I drop a MongoDB database from the command line?
- How to display records vertically in MySQL command line?
- How to list databases vertically in MySQL command line?
- How to upgrade MySQL server from command line?
- Avoid placing password on command line with MySQL Utilities?

Advertisements