MySQL 5.5 window设置默认字符集

MySQL 5.5 设置默认字符集(window)

  1. 打开安装目录
  2. 找到my.ini文件
  3. 使用editplus或记事本或其他文档编辑器打开该文件
# 找到如下内容,并在下一行增加内容
[mysql]		# 找到这一行
default-character-set=utf8 	# 这是新增的内容

# 使用查找功能,查找关键字character,查找结果如下
# The default character set that will be used when a new schema or table is
# created and no character set is defined
character-set-server=utf8	# 修改这一行的字符集编码为 utf8
  1. 保存文件
  2. 重启Mysql服务(在cmd黑窗口命令行中)
> net stop mysql
> net start mysql
# 进入数据库查看是否修改成功
> mysql -uroot -p
> ******
mysql> show variables like '%character%';

# 出现如下几个即为修改成功

+--------------------------+-----------------------------------+
| Variable_name            | Value                             |
+--------------------------+-----------------------------------+
| character_set_client     | utf8                              |
| character_set_connection | utf8                              |
| character_set_database   | utf8                              |
| character_set_filesystem | binary                            |		# 此处为binary,其余为utf8
| character_set_results    | utf8                              |
| character_set_server     | utf8                              |
| character_set_system     | utf8                              |
| character_sets_dir       | D:\software\MySQL\share\charsets\ |
+--------------------------+-----------------------------------+
8 rows in set (0.00 sec)

mysql>           

你可能感兴趣的:(MySQL)