ubuntu pdf无法显示中文
设置mysql自增字段的初始值

Debian下设置Mysql字符集消除中文乱码

Summer Flower posted @ 2011年3月10日 22:02 in 未分类 , 1676 阅读

1. 配置/etc/mysql/my.cnf文件

因为客户端使用的是gbk编码,所以在[client]和[mysqld]下都添加如下设置:

default-character-set=gbk

2. 建表时使用如下设置:


CREATE TABLE IF NOT EXISTS `signon` (
  `id` int(11) NOT NULL auto_increment COMMENT '系统自动生成的自动递增用户ID',
  `username` varchar(16) character set gb2312 NOT NULL COMMENT '用户帐号',
  `passwd` varchar(32) NOT NULL,
  PRIMARY KEY  (`id`),
  UNIQUE KEY `qq` (`username`)
) ENGINE=MyISAM  DEFAULT CHARSET=gbk AUTO_INCREMENT=1 ;

 

Avatar_small
Emma 说:
2023年1月19日 18:56

"If you find that your MySQL database is returning Chinese characters as garbled text, you can try setting the character set to UTF-8 on the Debian server. This can cbd oil health benefits be done by editing the MySQL configuration file, which is typically located at /etc/mysql/my.cnf. Find the [mysqld] section and add the following lines: character-set-server = utf8 collation-server = utf8_unicode_ci Save the file and restart MySQL for the changes to take effect."

Avatar_small
seo service UK 说:
2024年1月14日 17:32

I curious more interest in some of them hope you will give more information on this topics in your next article


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter