MySQL (3): Database operations

Source: Internet
Author: User

1. Create a database:

Data definition language (DDL);

Create DATABASE db_name[databases option]

Note: Database naming rules: Capitalization depends on the current operating system, see name, recommended underline

Character of the identifier:

Use any character, number, symbol, or even Chinese. But some special combinations, such as a combination of pure numbers, special symbols, including keys inside MySQL, should be wrapped with an identifier qualifier

Qualifier: Anti-quote

Chinese is also possible: but requires the client to encode

2. Querying a database that has already been created

show databases; (View show all databases)

Show Create Database db_name; ( view shows specific data)

3. Deleting a database

Drop database db_name; (irreversible, use caution)

4. Modify the Database

ALTER DATABASE db_name;

Note: Modify the name of the database

(1) Simple, directly modify the file directory;

(2) Export the data of the database, create a new database, import the data content, delete the old database;

(3) Create a new database that will move (rename) all the tables in the old database to the new database and delete the old database.

MySQL (3): Database operations

Related Article

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.