The solution of MySQL Chinese garbled problem

Source: Internet
Author: User
Tags ini mysql tutorial

Problem phenomenon:

A similar error occurs when inserting Chinese into MySQL tutorial 5.5

ERROR 1366 (HY000): Incorrect string value: ' Xd6xd0xcexc4 ' for column
Problem Reason:

Db CharacterSet's character set is set to Latin1

1, first determine whether the data is stored in garbled characters:
Mysql>select * from Yourtable;
See if it is garbled, that is, when you insert the data, the current page encoding and your MySQL encoding method is inconsistent.
2, if the exclusion of the above garbled possible, that is, the database tutorial can normally save Chinese, you need to check your page to display the encoding method


Locate the My.ini file modifications under the MySQL installation directory:





# SERVER Section
# ----------------------------------------------------------------------
# The following options would be read by the MySQL Server. Make sure that
# You have installed the server correctly (* above) so it reads this
# file.

# The TCP/IP Port the MySQL Server would listen on

#Path to installation directory. All paths are usually resolved relative to this.
Basedir= "C:/Program files/mysql/mysql Server 5.0/"

#Path to the database root
Datadir= "C:/Program files/mysql/mysql Server 5.0/data/"

# The default character set that'll be used when a new schema or table is
# created and no character set is defined

# The default storage engine that would be used when create new tables

Reference my.cnf

Modifying the default character set for MySQL is done by modifying its configuration file

The MySQL configuration file under Windows is My.ini, typically under the installation directory (such as C:Program Filesmysqlmysql Server 5.0), which can be added directly to the file

Then restart MySQL

View MySQL database server character set, database character set and client character set

Show variables like '%char% ';

Character_set_client, client Character set

Character_set_database, database Character set

Character_set_server, server character set

2. View the character set of the MySQL Datasheet (table)

Show table status from tablename like '%countries% ';

3. View the character set of the MySQL data Columns (column).

Show full columns from TableName;

4. View the character set supported by the currently installed MySQL.

Show Char set;

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: 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.