MySQL Learning note (2) Library operations

Source: Internet
Author: User

Library Operations (database)

1. Display Library:

Show databases; Show all libraries that already exist

Show databases like ' conditions '; Conditional Query

Conditional query:

% matches 0 or more arbitrary strings.

_ can match any one string.

2. View Library Materials:

Show CREATE database name;

3. To create a library:

Create database name;

notes: If a character set is not specified when the library is established, the default character set is used at installation time.

four levels of character sets: Server-level, database-level, data-table-level, field-level (field of string).

notes: The database supports multiple character sets.

4. fault Tolerant Way to build libraries:

Create database if not exists library name;

notes: If the library name is present, it cannot be established and the system issues an alert.

5. Library Name Wrapping method:

Create database ' system reserved word ';

notes: plus '(anti-quote) to force the creation of a library name for the system reserved word.

6. Specify the character set:

Create database name default charset= character set;

notes: the MySQL default character set is UTF8, not UTF-8.


7. To Modify a database:

Alter database name option;

notes: Create a library for each build : /mysql/data/ Library name / library name . Opt file, his content is to preserve the character set and proofing rules.

8. To delete a library:

Drop Database if exists library name;


This article is from the "Learning and Exchange" blog, please be sure to keep this source http://chenhaolinux.blog.51cto.com/9609922/1710764

MySQL Learning note (2) Library operations

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.