MySQL's character set support (Character set Support) has two aspects:
Character Set (Character set) and Sort method (collation).
The support for character sets is refined to four levels:
Servers (server), databases (database), Data tables (table)
Character_set_client:character_set_client: The character set used by the client source dataCharacter_set_connection: Connection Layer Character SetCharacter_set_results: Query result Character SetThe settings of the above three variables are only
MYSQL.CNF add[Mysqld]Character-set-server=utf8Collation-server=utf8_general_ci[Client]Default-character-set=utf8[MySQL]Default-character-set=utf8drop database user;CREATE DATABASE IF not EXISTS user character set UTF8;CREATE DATABASE IF not EXISTS
MySQL supports storing data using different character sets, supporting four levels of character set settings: Server, database, table, and column. MyISAM, MEMORY and InnoDB three storage engines support a different set of character sets.This article
1.1mysql Character Set Knowledge:Overview: A character set is a set of text symbols and their encoding, comparison rules. The MySQL database character set includes both the character set (character) and the proofing Rules (collation) concepts. Where
Encountered a SQL statement that created the databaseCREATE DATABASE testdb DEFAULT CHARACTER SET UTF8 COLLATE utf8_general_ci;Note : This specifies that the character set is used UTF8instead of utf-8.Interested in character SET and collate in the
1. List all the character sets supported by MySQL:SHOW CHARACTER SET;2. Current MySQL server character set settingsSHOW VARIABLES like ' character_set_% ';3. Current MySQL server character set checksum settingsSHOW VARIABLES like ' collation_% ';4.
In the relational database, ORACLE/SQL_SERVER/DB2 has a case-sensitive data, but MySQL is a bit strange, the data is not case-sensitive, see below for details.MySQL the default rules for database name, table name, column name, and alias
More Elementary,For further information, please refer to Sir Lou's blog:http://cenalulu.github.io/linux/character-encoding/http://cenalulu.github.io/mysql/mysql-mojibake/GBK and UTF8 's actual storage method inside the system:1 , GBK:> SELECT Hex (
Character Set length encoding method descriptionAcsii is the first groundbreaking character set of single-byte 7-bit encodingIso-8859-1/latin1 is a single-byte, 8-bit coded Western European character set, often used by some programmers to
The default character set for MySQL installed is latin1, in order to change its character set to user-required (such as UTF8), it must change its relevant configuration file, because the Linux under the default installation directory of MySQL under
MySQL Character set settings• System Variables:–character_set_server: Default internal operation character Set–character_set_client: The character set used by the client source data–character_set_connection: Connection Layer Character
After the MySQL link is established, set the encoding as follows:
Copy Code code as follows:
mysql_query ("SET character_set_connection=". $GLOBALS [' CharSet ']. ", character_set_results=." $GLOBALS [' CharSet ']. ",
Linux use service mysql restart command to restart MySQL service
The new database will use this character set as the default character set
Modify the character set of each database in the MySQL server
If there is a database before setting the
Scenario Description:
1, now on hundreds of MySQL database, character encoding latin1, now need to do an activity, will be on the MySQL database of some of the activity data synchronized to a MySQL summary database (latin1), and then the data
1.character_set_server and Collation_server
These two variables are the character set of the server. They can be set by--character-set-server and--collation-server when the system is started. If not, the system will set the two variables to default
Mysql
First of all, this article is purely my personal experience, applicable to my common environment and projects.Personally, the database character set uses UTF8 (the HTML page corresponds to UTF-8) so that your data can be migrated smoothly
For historical reasons, the UTF8 character set provided by MySQL in previous versions of 5.5.3 is not really utf8, it is just a subset of UTF8 and provides limited UTF8 support. Starting with mysql5.5.3, MySQL changed the internal details
MySQL includes character set support this enables you to store data using a variety of character sets and perform Comparis ONS according to a variety of collations. You can specify character. MySQL supports the use of characterMySQL supports
There are two common types ofUtf8_general_ci are in normal alphabetical order and are not case sensitive (e.g. a B c D)Utf8_bin in binary order (for example: A in front of a, B D a C)CI is case insensitive, that is, "casing is not sensitive", a and
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.