# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/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.
[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.
basedir = D:\\App Data\\mysql-5.7.10-winx64
datadir = D:\\App Data\\mysql-5.7.10-winx64\\data
port = 3306
skip-grant-tables
# 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
character-set-server=utf8
collation-server=utf8_general_ci
#STRICT_TRANS_TABLES: may lead unable to write chinese datas into db.
sql_mode=NO_ENGINE_SUBSTITUTION,NO_AUTO_CREATE_USER
[client]
# set default port and character set.
port = 3306
default-character-set=utf8
# Add user and password.
user = admin
password = admin
修改sql_mode的值如下,关键是去掉STRICT_TRANS_TABLES:
sql_mode=NO_ENGINE_SUBSTITUTION,NO_AUTO_CREATE_USER
mysql> SET NAMES utf8;
这种方法在某些机器上有效,在我的电脑上并不生效,但也可以一试。
show create database db_name;
alter database db_name default character set utf8 collate utf8_general_ci;
show create table table_name;
alter table table_name default character set utf8 collate utf8_general_ci;
alter table table_name change old_column_name new_column_name varchar(20) character set utf8 not null;
本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系我们删除。