how to Create, drop and rename of mysql database

how to Create, drop and rename of mysql database

How To Create DATABASE

The SQL CREATE DATABASE statement is used by a developer to create a database.

Let’s see the Example of CREATE SQL DATABASE:



SQL DROP statement is used By Developers to delete or remove the database.
If you want to delete or drop an existing database in a SQL than you can use SQL DROP DATABASE statement.

Let’s see the example of SQL DROP DATABASE:


If you delete or drop the database, all the tables and views will also be deleted. So be careful while drop Your SQL database.

How To Rename DATABASE

Sometimes you need to change the name of your database because of the original name was not more relevant to the data. Or, you just want to give a temporary name to that data for easy to remember.
SQL RENAME DATABASE statement is used to change the name of a database.

Let’s see the example of SQL Rename DATABASE:

RENAME DATABASE old_db_name TO new_db_name;

You Can Also use following command to change name of your database.

ALTER DATABASE old_name MODIFY NAME = new_name

About Author

My name is Mukesh Jakhar and I am a Web Application Developer and Software Developer, currently living in Jaipur, India. I have a Master of Computer Application in Computer Science from JNU Jaipur University. I loves to write on technology and programming topics. Apart from this, I love to travel and enjoy the beauty of nature.

Sign up for weekly update

Milkshake is almost ready. If you're interested in testing it out, then sign up below to get exclusive access.