MySQL Learning Note (4)-Creating a database

Source: Internet
Author: User

1. Create a simple database

1 CREATE DATABASE t1;

If the image is not hit, the system waits until the user enters the Terminator before the line statement.

2. View the list of databases under the current server

1 DATABASES;

Must be databases, the last s cannot be omitted.

The 3.IF NOT EXISTS statement checks for the existence of the current database and, if present, generates a warning message without generating an error message.

1 CREATE DATABASE IF  not EXISTS t1;

4. View the above warning message

1 SHOW WARNINGS;

s must not be omitted.

5. View instructions when creating a database

1 CREATE DATABASE t1;

6. Create a complete statement of the database

1 CREATE {DATABASE| SCHEMA [IF not EXISTS] db_name [DEFAULT] SET [=] charset_name;

7. Create a database example with GBK encoding format

CREATE DATABASE IF  not EXISTS character Set GBK

Both default and = can be ignored.

MySQL Learning Note (4)-Creating a database

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.