Unified Character Set guaranteed not garbled: suggested Chinese and English environment Choice UTF8
1.Linux system language
/etc/sysconfig/i18n
Lang= "Zh_cn.utf8"
2.mysql client
Temporary:
Set names UTF8;
Permanent:
configuration file my.cnf
[Client]
Default-charater-set=utf8
3.mysql server
[Mysqld]
Character-set-server=utf8
4.MySQL build database Build Table statement
Specify character Set Build library
Create DATABASE Oldboy_utf8 default Character set uft8 collate utf8_general_ci;
Specifying a character set to build a table
CREATE TABLE Student (
ID int (4) NOT NULL auto_increment,
Name Char (a) is not NULL,
Primary KEY (ID)
) Engine=inonodb auto_increment=10 Default Charset=utf8
5. character set of the development program
simulate The actual process of Modifying a database of the latin1 character set into a GBK character Set
1. Export table Structure
Mysqldump-uroot-p--default-character-set=latin1-d dbname >alltatale.sql
--default-character-set=latin1 connecting the- D only guide table structure with latin1
2. Edit alltable.sql to change latin1 to GBK
Sed replacement
3. Ensure that the database is not updated, export all data
Mysqldump-uroot-p--quick--no-create-info--extended-insert--default-character-set=latin1 dbname >alldata.sql
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/8B/0F/wKioL1hDvOXQXg4pAAKbP5wYnIA523.png "title=" Picture 1.png "alt=" Wkiol1hdvoxqxg4paakbp5wynia523.png "/>
4. Open alldata.sql to modify the set names latin1 to set names GBK; or modify the server and client of the system)
5. building a library
Create DATABASE dbname default CharSet bgk;
6. Create a table and execute alltable.sql
Mysql-uroot-p Dbname<alltable.sql
7. Import Data
Mysql-uroot-dbname < Alldata.sql
MySQL database character set garbled and library character set change