MySQL Character set

Source: Internet
Author: User
Tags mysql version create database

System environment: CentOS Linux release 7.4.1708 (Core)

MySQL version: 5.6.11 Scenario: Newly installed database, create database, create data table, insert Chinese data error resolution process: 1, modify the configuration file my.cnf add the following three       
= Utf8[mysql]default-character-set=utf8[client]default-character-set=utf8
 
2. Restart the database, and at the command line, see if the character set changes to UTF8 3. The database and data tables created by the original must change the character set1) database change character Set
ALTER DATABASE database_name default character set UTF8;
2) View database information   
Show CREATE DATABASE database_name;
3) data table change Character set    
ALTER TABLE table_name default character set UTF8;
4) View Create data table information
Show CREATE TABLE student_message;

       4, so far, insert Chinese characters will be error, because the data table column character set does not change1) You have to change the character set of the column.
Char (ten) character set UTF8  
2) After all changes, can be inserted successfully Summary: That is, from the library to the table, the character set from the table to the column has to be changed.

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