Default mysql encoding _ MySQL

Source: Internet
Author: User
Default mysql encoding problem bitsCN.com
Create database bbs2007; USE bbs2007; create table article (id int primary key AUTO_INCREMENT, pid INT, rootid INT, title VARCHAR (255), cont TEXT, pdate DATETIME, isleaf INT #1-not leaf 0-leaf); INSERT data to the table: insert into article VALUES (NULL, 0, 1, 'Ant vs. elephant ', 'Ant vs. elephant', NOW (), 1); ERROR 1406 (22001) when MySQL is inserted into Chinese ): data too long for column 'name' at row 1
Solution:
Run the set names gbk command before executing the SQL statement for data insertion. The reason is that the default encoding of MySQL Client is Latin1, which does not support Chinese characters. set names gbk. All fields are encoded in Chinese. From heirenheiren's column bitsCN.com

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.