Adjust MYSQL proofreading rules

Source: Internet
Author: User


Adjust the MYSQL checking rule gbk_bin to binary storage. gbk_chinese_ci is case-insensitive. server adjustment [mysqld] default-character-set = gbk # add this item to MySQL 5.5 -- default-character-set is removed in MySQL. default-collation = gbk_bin # Add this character-set-server = gbk for MYSQL5.1 # Add this collation-server = gbk_bin for MYSQL5.5 # add this item for MYSQL5.5 but create if COLLATTION is not specified for the database, by default, gbk_chinese_ci www.2cto.com 2 is inherited from the server. the client adjusts mysql> show variables like 'collation _ % ';# + Before adjustment + | variable_name | value | ---------------------------------------------- collation_connection | gbk_chinese_ci | ---------------------------------------------- collation_database | gbk_bin | --> after the server is adjusted (before adjustment, it is gbk_chinese_ci) | -------------------------------------------- collation_server | gbk_bin | --> after the server is adjusted (before the adjustment, it is gbk_chinese_ci) | ----------------------------- ----------------- Mysql> set names 'gbk' collate 'gbk _ bin'; # After adjustment, let's look at the following mysql> show variables like 'collation _ % '; + rows + | variable_name | value | ---------------------------------------------- collation_connection | gbk_bin | ---------------------------------------------- collation_database | gbk_bin | ---------------------------------------------- collation_server | gb K_bin | ---------------------------------------------- www.2cto.com 3. you can use the command to check the rules for mysql> show full columns from tbz; 4. create database if not exists test default character set gbk COLLATE gbk_bin; create table 'tbz' ('bz' varchar (3) not null, 'bzmc 'varchar (16) not null, 'bzbm' varchar (1) default null, 'sm 'varchar (20) default null, primary key ('bz ')) ENGINE = InnoDB default charset = gbk COLLATE gbk_bin; 5. How can I change the default value of the current default rule ?? Mysql> show collation like 'gbk % '; + domains www.2cto.com | Collation | Charset | Id | Default | Compiled | Sortlen | bytes | gbk_chinese_ci | gbk | 28 | YES | 1 | gbk_bin | gbk | 87 | | YES | 1 | ------------------------------------------- ---------------------------------------- 6. character encoding and verification rules priority MySQL Character Set and verification rules have four levels of default settings: server level, database level, table level, and field level. We recommend that you specify character sets and verification rules when creating a database to avoid being affected by default values. Author Cai lei

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.