Settings for Mysql:charset and collation

Source: Internet
Author: User

From:http://www.2cto.com/database/201302/189920.html

Mysql:charset and collation settings  charset and collation have multiple levels of settings: server-level, database-level, table-level, column-level, and connection-level    www.2cto.com- 1. Server-level    view settings: Show global variables like ' character_set_server '; And show global variables like ' collation_server ';   Modify settings: Set:   in Option FILE (/ETC/MYSQL/MY.CNF)  [mysqld]     character_set_server=utf8     COLLATION_SERVER=UTF8_GENERAL_CI   2. Database level      View settings: SELECT * from information_schema.schemata where schema_name = ' Cookbook ';     Set:      1. If not explicitly set, the server-level configuration       2 is used automatically. Explicit settings: Specify    when creating a library      create database PlayUtf8  default CHARACTER SET latin1 COLLATE latin1_swedish_ci;   ww w.2cto.com  3. Table level      View settings: Show create table course;     Settings:       1. If not explicitly set, automatically use database-level configuration       2. Explicit settings: Specify         create table when creating tableUTF (ID int) default CHARSET=UTF8 default collate=utf8_bin;  4. Column level      View settings: Show CREATE TABLE Cou rse;     Settings:      1. If not explicitly set, the table-level configuration       2 is automatically used. Explicitly set:        create TABLE Table1 (Column1 VARCHAR (5) CHARACTER SET latin1 COLLATE latin1_german1_ci);  & Nbsp;5. Connection level    View settings:      show variables like ' character_set_client '; The  # server uses this code to understand the statements      show variables like ' character_set_connection ' sent by the client; # I don't know what it means, wait to see the MySQL source       show variables like ' character_set_results '; # The server uses this encoding to echo the result set and error messages    settings:       The client can specify these parameters when connecting, and the server also provides a global range of values when the client does not specify these parameters. This global value is used by the server. How is this global value set? I've looked through a lot of documents and it seems like I haven't seen the setup yet (some say it's wrong to specify command-line arguments by MY.CNF, or when starting mysqld)   : What code is used to connector/j transfer SQL?    Answer: "The character encoding between client and server is automatically detected uponConnection. The encoding used by the driver are specified on the server using the CHARACTER_SET_SERVER system variable for server Versi ONS 4.1.0 and newer. "      That is, the Character_set_server value is queried on the server side when connecting, and then the encoding used by the connection is determined.      However, the official document also says, "to override the auto-detect encoding feature on the client, you can use the" characterencoding "attribute in the URL used to connect to the server. "  

Settings for Mysql:charset and collation

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.