MySQL basic operation of the database

Source: Internet
Author: User
Tags create database

First, create a database

The SQL syntax format for creating databases in MySQL is:

CREATE database name;

Where the database name cannot have the same name as the database that already exists. To create a database test_db:

You can view the definition of a database by using the following statement:

SHOW CREATE database name (\g);

where "\g" means formatted output, which can be added without adding. As shown in the following:

You can use the following how to view all currently existing databases:

SHOW DATABASES;

Second, delete the database

The SQL syntax format for deleting a database in MySQL is:

DROP database name;

As shown, delete the test_db database:

After you delete the database and then view the definition of the database, you will get an error:

Note : be careful when using the delete database command because MySQL does not give any reminder confirmation when the command is executed, and after the database is deleted, all data tables and data stored in the database are deleted together and cannot be recovered.

MySQL basic operation of the database

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.