In general, we add the configuration in the configuration file my.cnf:[Client]default-character-set = UTF8 [mysqld]default-character-set = utf8character-set-server = Utf8init-connect = ' Set NAMES UTF8 ' collation-server = utf8_general_ci
Inserting data in MySQL always shows yes??? Garbled. Online very many people said that the test is not correct, later after a large number of inquiries, the solution is written in the following. Different version numbers have different ways of
Then the previous article went on to talk about the character set story. This article focuses on the various character set settings for MySQL, and for the basic theory section, refer to here. 1. mysql's system variables – character_set_server:
--View all character encodingsSHOW CHARACTER SET;--View the instructions for creating the database and view the encoding used by the databaseShow CREATE Database dbtest;--View Database encoding:Show variables like '%char% ';--Set the
Encoding: Computers are binary storage, so the display symbols need to be converted to binary numbers to be stored, and each character is converted into a binary number, which is the character encoding.Character SetCharacters are used to display
MySQL Character set settings view
1. List all the character sets supported by MySQL:
SHOW CHARACTER SET;
2. Current MySQL server character set settings
SHOW VARIABLES like ' character_set_% ';
3. Current MySQL server
MySQL Character set support (Character set supports) has two aspects:The character set (Character set) and the Sort method (Collation).Support for character sets is refined to four levels:Servers (server), database, data tables (table), and
Let's talk about MySQL. When compiling the installation, the options for the character set (http://coosh.blog.51cto.com/6334375/1735271)Specify the default character set for the database-ddefault_charset=utf8Specify the default proofing character
Source Address: http://www.blogjava.net/zyskm/archive/2013/04/09/361888.html The concept of a character set everyone knows, proofing rules many people do not understand, the general database development is also not used in this concept, MySQL in
Variables like ' character_set%% ' by show
There are several ways to modify MySQL encoding:
1. Modify My.ini (under Windows) or/ETC/MY.CNF (under Linux) via configuration files
Add the following separately
[Mysqld]
Character_server_set=utf8
[
Today, a development colleague uses the JDBC connection database to execute a statement with no result set, but executes the same statement through Sqlyou with a return result.The statement that executes the Where condition contains Chinese, which
Question: When Unbuntu used Eclipse to write a program, it found that the Chinese characters that were stored in the database MySQL became the???Cause: The default encoding for Eclipse and MySQL is inconsistentWorkaround: Set both the Eclipse and
View MySQL's character setMysql> Show variables like ' collation_% ';+----------------------+-----------------+| variable_name | Value |+----------------------+-----------------+| collation_connection | Utf8_general_ci || Collation_database |
The content is short but is dry, practice + theory Summary, welcome to shoot BricksDisclaimer: The following code does not apply to sorted sets1) Set names and Default-character-set equivalent2) When writing the set names (Default-character-set)
The installation of MySQL many times, each time will be entangled in the database character encoding configuration, so I decided this time to completely clarify it.MySQL's character encoding structure is relatively thin, it is divided into two parts:
Let's look at the following execution results:(Root@localhost)[(None)]Mysql>Show variables like 'character%';+--------------------------+-------------------------------------------------------------+|Variable_name|Value|+--------------------------+--
Linux, when we use the MySQL C API to operate the MYSQLDB, by default, the program will be Latin1 this character set to do SQL operations, this situation, it is likely to appear garbled,For example, the character set of the database is UTF8, and
Create three table TB_LATIN1,TB_UTF8,TB_GBK, encoded as LATIN1/UTF8/GBKThe "Hello a" string is encoded as followsGBK:%c4%e3%ba%c3%61UTF-8:%e4%bd%a0%e5%a5%bd%61The test code is as followsPHP//fileencoding=gb2312mysql_query("Set Names
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.