How to Create MySQL Database and Table..?

How to create MySQL database and table?

create mysql database and table


MySQL is an open-source relational database management system (RDBMS); in July 2013, it was the world’s second most widely used RDBMS, and the most widely used open-source client–server model RDBMS. It is named after co-founder Michael Widenius’s daughter, My.The SQL acronym stands for Structured Query Language. The MySQL development project has made its source code available under the terms of the GNU General Public License, as well as under a variety of proprietary agreements. MySQL was owned and sponsored by a single for-profit firm, the Swedish company MySQL AB, now owned by Oracle Corporation.[11] For proprietary use, several paid editions are available, and offer additional functionality.

  • CREATE DATABASE command is used for creating database in mysql
  • DROP DATABASE command is used for dropping or deleting database from mysql
  • CREATE TABLE command is used for creating tables in mysql

Read Also: Create user in  MySQL from command line

Creating MySQL Database

Step 1: Login into mysql using root user or other admin user;

mysql -u root -p

Step 2: Use CREATE DATABASE to create database as follows:

CREATE DATABASE installvirtual;

Now, the database is created.


How to backup MySQL database?

Now Use database with use command as follows:

USE installvirtual;

Step 3: Now we can create table in installvirtual database using CREATE TABLE command

CREATE TABLE users (name VARCHAR(20), email VARCHAR(20));

Check tables in installvirtual database by following command


Step 4: Now we can add data to our table

INSERT INTO users (name,email) VALUES ("john","[email protected]");

To display the rows from the table use following command

SELECT * FROM users;

Deleting or Dropping Database

If you want to delete or drop database use DROP DATABASE command:

DROP DATABASE installvirtual;

Now you know how to Create database, Create table, inserting data into table and dropping mysql database.

Read Also: Basic Docker Commands

If you any issue using this tutorial please feel free to comment..

Leave a Reply

Your email address will not be published.


The reCAPTCHA verification period has expired. Please reload the page.

48-Hour Flash Sale! Courses from just $10.99