MySQL Operating Manual

Source: Internet
Author: User

    • View the database encoding format
    1. View database encoding format: Show variables like ' character_set_database ';
    2. View the encoding format for the datasheet: Show create table < table name >;
    3. View the character set of the MySQL data column (column): Show full columns from < table name >;
    4. Specify the character set of the database when you create the database: Create databases < database name > character set UTF8;
    5. Modify the encoding format of the database: ALTER databases < database name > character set UTF8;
    6. Modify data Table encoding format: ALTER TABLE < table name > character set UTF8;
    7. Modify field encoding format: ALTER TABLE < table name > change < Field name > < Field name > < type > Character set UTF8;
    8. View the currently installed MySQL supported character sets: Show CharSet;
    9. Modify the default server character set in MY.CNF: Character-set-server=utf8

    • Change Table structure
    1. Add field: ALTER TABLE table_name ADD COLUMN column_name varchar (+) after ' uid '; (which field is added later)
    2. Delete field: ALTER TABLE table_name drop COLUMN column_name;
    3. To modify a field type:

ALTER TABLE name modify column field name type; "Modify column Type"

ALTER TABLE table_name change old_col new_col int unsigned not NULL default 0; "Modify column name and column type"

    • Change index
    1. Add index
    2. Delete Index
    3. modifying indexes

MySQL Operating Manual

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.