MySQL garbage collection _ Continuous update

Source: Internet
Author: User

1.Execute the following sentence successfully in MySQL, can be added in Chinese.

Insert into book (bookname,author,publish) VALUES (' Good ', ' Hao ', ' Hao ');

However, executing this INSERT statement in the JSP will cause garbled characters.

Solution: Add the useunicode=true&characterencoding=utf-8 after the URL .


2, import the TXT file in the SQL statement, garbled.

First execute show variables like '%char% ';

+--------------------------+---------------------------------------------------------+
| variable_name | Value |
+--------------------------+---------------------------------------------------------+
| character_set_client | GBK |
| character_set_connection | GBK |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | GBK |
| character_set_server | latin1 |
| character_set_system | UTF8 |
| character_sets_dir | C:\Program files\mysql\mysql Server 5.0\share\charsets\ |
+--------------------------+---------------------------------------------------------+
8 rows in Set (0.00 sec)

Add in My.ini:
[MySQL]

default-character-set=gb2312
[Mysqld]
default-character-set=gb2312

then restart the MySQL service.

Enter the database

ALTER DATABASE charset = gb2312;

also remember to write the set names gb2312 in front of the script that imports the database;

this will be OK.

alter database   your database name  charset = gb2312;


3, navicat table input data garbled

set names ' GBK ';

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.