在mysql配置文件 mysql.ini 中的
[mysqld]下面添加
sql_mode = 'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'
之后重启mysql
如果是解压版可能在安装路径中没有mysql.ini,那就手动创建一个配置文件。注意:
basedir=D:\workApp\mysql\mysql-5.7.33-winx64/
datadir=D:\workApp\mysql\mysql-5.7.33-winx64/data/
需要替换为自己的安装路径
[mysql]
default-character-set=utf8
[mysqld]
port=3306
#注意路径是自己的mysql安装路径
basedir=D:\workApp\mysql\mysql-5.7.33-winx64/
datadir=D:\workApp\mysql\mysql-5.7.33-winx64/data/
character-set-server=utf8
default-storage-engine=InnoDB
max_connections=100
collation-server=utf8_unicode_ci
init_connect='SET NAMES utf8'
innodb_buffer_pool_size=64M
innodb_flush_log_at_trx_commit=1
innodb_lock_wait_timeout=120
innodb_log_buffer_size=4M
innodb_log_file_size=256M
interactive_timeout=120
join_buffer_size=2M
key_buffer_size=32M
log_error_verbosity=1
max_allowed_packet=16M
max_heap_table_size=64M
myisam_max_sort_file_size=64G
myisam_sort_buffer_size=32M
read_buffer_size=512kb
read_rnd_buffer_size=4M
server_id=1
skip-external-locking=on
sort_buffer_size=256kb
table_open_cache=256
thread_cache_size=16
tmp_table_size=64M
wait_timeout=120
sql_mode = 'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'
[client]
port=3306
default-character-set=utf8