MySQL Create, modify, and delete databases

Source: Internet
Author: User
Tags mysql create

    • Create a database
CREATE DATABASE [IF not EXISTS] CHARACTER SET [=] UTF8;

The code in brackets is optional; Charater is created as the default character if you do not write.

After you have created the database, you can:

SHOW DATABASES;

See how many databases are currently available;

When using [IF not EXISTS] to create an existing database, there is no error, but a warning. Can be used:

SHOW WARNINGS;

To view the contents of the warning, although there is a bit of dog blood here, there may be other warnings later.

    • Modify Database

When modifying a keyword, alter, if you want to modify the T1 character set, use:

ALTER DATABASE CHARACTER SET = GBK;

After you have modified it, you can use:

CREATE DATABASE t1;

To display the instructions at the time of creation to see if the character set has been modified.

    • Deleting a database
DROP DATABASE t1;

This removes the previously created T1 database.

MySQL Create, modify, and delete databases

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.