1: linux: mysql
要使下面的变量,才可以正确显示。
+--------------------------+----------------------------------------+
| Variable_name | Value |
+--------------------------+----------------------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/local/mysql/share/mysql/charsets/ |
| collation_connection | utf8_general_ci |
| collation_database | utf8_general_ci |
| collation_server | utf8_general_ci |
+----------------------+-----------------+
需 具体看my.cnf的配置.
(#cp /usr/local/mysql/support-files/my-medium.cnf /etc/my.cnf)
#下面是很重要的=====================================
[client]
#password = your_password
port = 3306
socket = /tmp/mysql.sock
default-character-set = utf8
[mysqld]
port = 3306
socket = /tmp/mysql.sock
skip-locking
key_buffer = 16M
max_allowed_packet = 1M
table_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
default-character-set = utf8
建表sql需要用utf8
/*
SQLyog Enterprise - MySQL GUI v7.0 Beta 1
MySQL - 4.1.22-log : Database - GTEST
*********************************************************************
*/
/*!40101 SET NAMES utf8 */;
/*!40101 SET SQL_MODE=''*/;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
CREATE DATABASE /*!32312 IF NOT EXISTS*/`GTEST` /*!40100 DEFAULT CHARACTER SET utf8 */;
USE `GTEST`;
/*Table structure for table `test` */
DROP TABLE IF EXISTS `test`;
CREATE TABLE `test` (
`M` int(11) NOT NULL default '0',
`N` varchar(100) default NULL,
PRIMARY KEY (`M`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
/*Data for the table `test` */
insert into `test`(`M`,`N`) values (1,'测试');
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
2:windows 下面中文
间数据库的时候,需要选择 utf-8
用客户端的时候需要选择,要使用SQLyon 7.0以上的高版本
posted on 2008-09-04 17:43
波 阅读(377)
评论(0) 编辑 收藏