MySQL encoding, data table encoding view and revision summary

Source: Internet
Author: User

1. Check the code for your own installed MySQL


2. View MySQL-supported encodings


3. View Database encoding


4. View Data sheet encoding (Show create table user \g;)


5, modify the My.ini file to modify the code: plus default-character-set= Character set (utf8.gbk.gb2312, etc.)


6. Command line modification: ALTER DATABASE da_name default character set ' CharSet '; or set names 'charset'; ALTER DATABASE TestDB CHA Racter set UTF8;


8. View the database service and the client character set:


9, the Linux system changes:

1) Export Data
[Email protected] ~]$ mysqldump-u root-p dbname--default-character-set=gbk > base_user.sql;

2) View the encoding of the exported SQL file
[[Email protected] ~]$ file Base_user.sql
Base_user.sql:utf-8 Unicode text, with very long lines

3) Turn to the code you want to use
[Email protected] ~]$ iconv-f utf-8-t GBK base_user.sql >base_user_gbk.sql

4) Connect to the database and view the encoding of the current library
[Email protected] ~]$ Mysql-uroot
mysql> use TestDB;

mysql> status;
Server characterset:latin1
Db CHARACTERSET:GBK
Client characterset:latin1
Conn. characterset:latin1

5) Set the required encoding
Mysql>set names ' GBK ';

6) View the current encoding
mysql> status;
Server characterset:latin1
Db CHARACTERSET:GBK
Client CHARACTERSET:GBK
Conn. CHARACTERSET:GBK

7) Import the files we converted into GBK
Mysql> source Base_user_gbk.sql;


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.