MySQL 修改字符集(Windows)

1.查询字符集

 

mysql>show variables like 'char%';

mysql>show variables like 'coll%';

 

2.更改my.ini文件

 

[client]

port=3306

[mysql]

default-character-set=utf8


# SERVER SECTION
# ----------------------------------------------------------------------
#
# The following options will be read by the MySQL Server. Make sure that
# you have installed the server correctly (see above) so it reads this
# file.
#
[mysqld]

# The TCP/IP Port the MySQL Server will listen on
port=3306


#Path to installation directory. All paths are usually resolved relative to this.
basedir="D:\Program\MySQL\MySQL Server 5.5"

#Path to the database root
datadir="D:\Program Data\MySQL\MySQL Server 5.5\data"

# The default character set that will be used when a new schema or table is
# created and no character set is defined


#default-character-set=utf8
init_connect='SET collation_connection = utf8_general_ci'
init_connect='SET NAMES utf8'
character-set-server=utf8
collation-server=utf8_general_ci

 

3.重启服务

net stop mysql

net start mysql

posted on 2017-03-03 09:18  榴莲小公子  阅读(149)  评论(0编辑  收藏  举报