[mysql-Ver5.6.23] windows版my.ini配置

基于utf8mb4比utf8多了种编码,能更好的支持emoji表情(http://dev.mysql.com/doc/refman/5.5/en/charset-unicode-utf8mb4.html),所以我想让自己的mysql服务器默认使用utf8mb4编码。

于是就得到了配置文件 D:dbMySQLData5.6my.ini(并不是D:dbMySQLServer5.6my-default.ini)

[client]
no-beep
port=3306

[mysql]


[mysqld]
port=3306
datadir=D:/db/MySQL/Data5.6/Data

character-set-client-handshake = FALSE
character-set-server=utf8mb4
collation-server = utf8mb4_general_ci
init_connect='set names utf8mb4'


default-storage-engine=INNODB

sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"


log-output=FILE
general-log=0
general_log_file="TIANXIAOKU.log"
slow-query-log=1
slow_query_log_file="TIANXIAOKU-slow.log"
long_query_time=10


log-error="TIANXIAOKU.err"

server-id=1

max_connections=151

query_cache_size=0

table_open_cache=2000

tmp_table_size=48M

thread_cache_size=10

myisam_max_sort_file_size=100G

myisam_sort_buffer_size=87M

key_buffer_size=8M

read_buffer_size=64K
read_rnd_buffer_size=256K

sort_buffer_size=256K



innodb_additional_mem_pool_size=7M

innodb_flush_log_at_trx_commit=1

innodb_log_buffer_size=4M

innodb_buffer_pool_size=280M

innodb_log_file_size=48M

innodb_thread_concurrency=17

innodb_autoextend_increment=64

innodb_buffer_pool_instances=8

innodb_concurrency_tickets=5000

innodb_old_blocks_time=1000

innodb_open_files=300

innodb_stats_on_metadata=0

innodb_file_per_table=1

innodb_checksum_algorithm=0

back_log=80

flush_time=0

join_buffer_size=256K

max_allowed_packet=4M

max_connect_errors=100

open_files_limit=4161

query_cache_type=0

sort_buffer_size=256K

table_definition_cache=1400

binlog_row_event_max_size=8K

sync_master_info=10000

sync_relay_log=10000

sync_relay_log_info=10000

 其中最主要的是以下几句:

character-set-client-handshake = FALSE  # 设置客户端使用服务端配置的编码,忽略客户端编码的配置
character-set-server=utf8mb4       # 设置服务端编码
collation-server = utf8mb4_general_ci    # 设置服务端排序规则
init_connect='set names utf8mb4'

还有个需要注意的就是:

1. default-storage-engine=INNODB 默认的数据存储引擎

2. sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"  规则越严格,意味着操作时受到的限制越多!

----------------------------------------------------------------------

再贡献一个windows上的phpstudy中mysql下的my.ini(D:softphpStudyMySQLmy.ini)配置:

#  power by phpStudy  2014  www.phpStudy.net  官网下载最新版

[client]
port=3306

[mysql]


[mysqld]
port=3306
basedir="D:/soft/phpStudy/MySQL/"
datadir="D:/soft/phpStudy/MySQL/data/"
character-set-client-handshake=FALSE
character-set-server=utf8mb4
collation-server=utf8mb4_general_ci
default-storage-engine=InnoDB
init_connect='set names utf8mb4'
sql-mode="NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
max_connections=512

query_cache_size=0
table_cache=256
tmp_table_size=18M

thread_cache_size=8
myisam_max_sort_file_size=64G
myisam_sort_buffer_size=35M
key_buffer_size=25M
read_buffer_size=64K
read_rnd_buffer_size=256K
sort_buffer_size=256K

innodb_additional_mem_pool_size=2M

innodb_flush_log_at_trx_commit=1
innodb_log_buffer_size=1M

innodb_buffer_pool_size=47M
innodb_log_file_size=24M
innodb_thread_concurrency=8

  

原文地址:https://www.cnblogs.com/joeblackzqq/p/4976215.html