Got it

The Series of MySQL -4- MySQL User Management - EP 04_04

Latest reply: Feb 24, 2022 10:20:04 598 12 10 0 0

The Series of MySQL -4- MySQL User Management - EP 04_04




HI Hi, Greetings!  i_f47.gif

Happy February i_f25.gif


Hi Everyone,



Today, I would like to share with you an article about the fourth episode of Series of MySQL (MySQL Database), and the content is given below.

 

a.    Create Database

b.   Select Database

c.    Show Databases

d.   Drop Database

e.    Copy Database 

 

Drop Database


With the MySQL DROP DATABASE command, we may rapidly drop/delete/remove a MySQL database. It will permanently remove the database, including all tables, indexes, and constraints. As a result, we must exercise extreme caution while deleting a database with MySQL, as we will lose all of the database's contents. The DROP DATABASE statement returns an error if the database is not available on the MySQL server.

 

A database can be dropped, deleted, or removed in MySQL in one of two ways:

·        MySQL Command Line Client

·        MySQL Workbench

 

MySQL Command Line Client

 

In MySQL, we can delete an existing database by executing the DROP DATABASE statement, which has the following syntax:

 

DROP DATABASE [IF EXISTS] database_name;    

 

For removing a database in MySQL, we can use the syntax below. Because the schema is a synonym for the database, we can interchange the two terms.

 

DROP SCHEMA [IF EXISTS] database_name;  

 

The following are the parameter descriptions for the above syntax:

·       database_name

It's the name of an existing database on the server that we wish to remove. In the MySQL server instance, it should be unique.

·        IF EXISTS

It's a choice. It prevents an error from occurring when uninstalling a database that does not exist.

 

Example

 

With the help of an example, let's learn how to drop a database in MySQL. If we set the password during installation, open the MySQL console and write it down. We are now prepared to delete a database.

 

Next, use the "SHOW DATABASES" query to see all of the server's databases:

 

17

 

Let's say we wish to delete the database "empdb1". Execute the following command:

 

DROP DATABASE empdb1;  

 

By running the following query, we can see if our database has been destroyed or not. It will seem as follows:

 

18

 

We can see from the above that the database "empdb1" has been successfully erased.

 

 

MySQL Workbench (Used to DROP a database).

 

To utilize this tool to dump a database, we must first open the MySQL Workbench and log in with the MySQL server's username and password. The following screen will appear:

 

19

 

Execute the following steps to delete the database:

 

Select the Schema menu from the Navigation tab. We can view all of the databases that have been built previously in this section. If you want to delete a database, right-click it under the Schema menu, for example, "empdb1", and pick Drop Schema from the menu, as shown in the following screen.

 

20


 

 

MySQL Workbench presents a popup box to confirm the deletion process when we select Drop Schema. If we choose Review SQL, the SQL query that will be run will be generated. If we select the Drop Now option, the database will be permanently erased.

 

21

 

It is necessary to select the Review SQL option if we want to delete the database safely. Once we're certain, click the Execute button to put the statement into action. The screen below describes it in greater detail:

 

22

 

MySQL will return the following message once we click the execute button, indicating that the database has been successfully discarded. The number of affected rows is zero because the database "empdb1" is an empty database.

 

23

 

When we look at the schemas tab, we notice that the "empdb1" database is no longer listed.




You are welcome to like and leave feedback in the comment area.


Link:


EP 03_01:

The Series of MySQL - 4 - MySQL User Management - EP 04_01




EP 03_02:

The Series of MySQL -4- MySQL User Management - EP 04_02



EP 03_03:

The Series of MySQL -4- MySQL User Management - EP 04_03


EP 03_05:

Source:

  • https://www.w3schools.com/mySQl/default.asp

  • https://www.mysqltutorial.org/mysql-basics/



M M Zaheer Hussain

Stay Safe!

tt


The post is synchronized to: Author groupzaheernew's Author Collection

  • x
  • convention:

zaheernew
MVE Author Created Feb 19, 2022 08:25:54

  • x
  • convention:

Saqibaz
Saqibaz Created Feb 22, 2022 06:33:28 (0) (0)
 
Saqib123
Moderator Created Feb 19, 2022 11:41:55

Thanks for sharing
View more
  • x
  • convention:

Unicef
MVE Created Feb 19, 2022 12:04:16

GOOD
View more
  • x
  • convention:

MahMush
Moderator Author Created Feb 20, 2022 05:59:07

complete and concise
View more
  • x
  • convention:

Rumana
Created Feb 21, 2022 05:28:35

Good job
View more
  • x
  • convention:

BWGARM
Created Feb 21, 2022 05:32:31

The Series of MySQL -4- MySQL User Management - EP 04_04-4697397-1
View more
  • x
  • convention:

MahMush
Moderator Author Created Feb 21, 2022 06:42:29

good one
View more
  • x
  • convention:

Anno7
Moderator Author Created Feb 21, 2022 06:57:39

thankyou for sharing
View more
  • x
  • convention:

Saqibaz
Created Feb 22, 2022 06:33:37

Thanks for sharing
View more
  • x
  • convention:

12
Back to list

Comment

You need to log in to comment to the post Login | Register
Comment

Notice: To protect the legitimate rights and interests of you, the community, and third parties, do not release content that may bring legal risks to all parties, including but are not limited to the following:
  • Politically sensitive content
  • Content concerning pornography, gambling, and drug abuse
  • Content that may disclose or infringe upon others ' commercial secrets, intellectual properties, including trade marks, copyrights, and patents, and personal privacy
Do not share your account and password with others. All operations performed using your account will be regarded as your own actions and all consequences arising therefrom will be borne by you. For details, see " User Agreement."

My Followers

Login and enjoy all the member benefits

Login

Block
Are you sure to block this user?
Users on your blacklist cannot comment on your post,cannot mention you, cannot send you private messages.
Reminder
Please bind your phone number to obtain invitation bonus.
Information Protection Guide
Thanks for using Huawei Enterprise Support Community! We will help you learn how we collect, use, store and share your personal information and the rights you have in accordance with Privacy Policy and User Agreement.