日期:2014-05-16  浏览次数:20598 次

My SQL 5.6.X 设置修改数据库编码

默认的my-sample.ini改为 my.ini

如果是绿色版的,可以直接修改该文件实现修改编码等。。。。

以下是我的设置 仅供参考(编码为UTF-8)

?

?

??? my.ini:

# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.
[client]
default-character-set=utf8

[mysqld]

# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M

# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin

# These are commonly set, remove the # and set as required.
port=3306
basedir=D:\dev_tools\mysql_5.6
datadir=D:\dev_tools\mysql_5.6\data
default-storage-engine=INNODB
character_set_server=utf8
collation-server=utf8_general_ci
# server_id = .....


# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M 

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 

?

??? 查看mysql的编码:

mysql> show variables like 'character%';
+--------------------------+----------------------------------------+
| Variable_name            | Value                                  |
+--------------------------+----------------------------------------+
| character_set_client     | utf8                                   |
| character_set_connection | utf8                                   |
| character_set_database   | utf8                                   |
| character_set_filesystem | binary                                 |
| character_set_results    | utf8                                   |
| character_set_server     | utf8                                   |
| character_set_system     | utf8                                   |
| character_sets_dir       | D:\dev_tools\mysql_5.6\share\charsets\ |
+--------------------------+----------------------------------------+
8 rows in set (0.00 sec)

mysql>

?