Mysql encoding and data table encoding viewing and modification Summary

Source: Internet
Author: User
Mysql encoding, data table encoding view and modification Summary 1. view the mysql encoding that you have installed 2. view the Mysql supported encoding 3. view the database encoding 4. view the data table encoding (showcreatetableuserG ;) 5. modify my. INI file to modify the encoding: add the default-character-set character set (utf8.gbk. gb2312, etc.) 6,

Summary of viewing and modifying mysql encoding and data table encoding 1, view the mysql encoding that you have installed 2. view the encoding supported by Mysql 3. view the database encoding 4. view the data table encoding (show create table user \ G;) 5. modify my. INI file to modify the encoding: Add default-character-set = character set (utf8.gbk. gb2312, etc.) 6,

Summary of viewing and modifying mysql encoding and data table Encoding

1. Check the encoding of your installed mysql.


2. Check the encoding supported by Mysql.


3. view the database code


4. view the data table encoding (show create table user \ G ;)


5. Modify the my. ini file to modify the encoding: add the default-character-set = character set (utf8.gbk. gb2312, etc)


6. Modify the command line: alter database da_name default character set 'charset'; or set names 'charset'; or alter database testdb character set utf8;


8. view the character set of the Database Service and client:


9. Modifications in Linux:

1) Export data
Root@www.cnscn.org ~ $ Mysqldump-u root-p dbname -- default-character-set = gbk> base_user. SQL;

2) view the exported SQL file encoding
Root@www.cnscn.org ~ $ File base_user. SQL
Base_user. SQL: UTF-8 Unicode text, with very long lines

3) convert to the encoding to be used
Root@www.cnscn.org ~ $ 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 database
Root@www.cnscn.org ~ $ Mysql-uroot
Mysql> use testdb;

Mysql> status;
Server characterset: latin1
Db characterset: gbk
Client characterset: latin1
Conn. characterset: latin1

5) set it to 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 file converted to 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.