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