2013年10月18日 星期五

mysql-utf8

mysql menu
http://dev.mysql.com/doc/refman/5.0/en/connector-j-reference-configuration-properties.html



create table foo (v varchar(10)) CHARACTER SET utf8 COLLATE utf8_general_ci;
insert into foo values('太原星河湾酒店');
select * from foo; 


http://stackoverflow.com/questions/295417/format-integer-to-string-with-5-digits


Ensure that your MySQL configuration encoding is defined correctly. Check your settings and the correctness of the modifications with these commands:
show variables like 'character%';
and show variables like 'collation%';
Add these lines to either my.cnf or my.ini:
For MySQL 5.1.nn, and later versions 5.5.29 you just need these two lines:
[mysqld]
character-set-server = utf8
character-set-filesystem = utf8
For MySQL 5.0.nn and older use these settings:
[client]
default-character-set=utf8

[mysql]
default-character-set=utf8

[mysqld]
default-character-set=utf8
character-set-server=utf8
It is probably more convenient to use MySQL-Workbench for your settings. Versions 5+ are excellent.

沒有留言:

張貼留言