@echo off
@echo Mysql startup ...
start bin\mysqld.exe --defaults-file=my.ini --port=3306
exit
在mysql目录创建配置 my.ini
# Example MySQL config file for medium systems.## This is for a system with little memory (32M - 64M) where MySQL plays# an important part, or systems up to 128M where MySQL is used together with# other programs (such as a web server)## You can copy this file to# /etc/my.cnf to set global options,# mysql-data-dir/my.cnf to set server-specific options (in this# installation this directory is C:\mysql\data) or# ~/.my.cnf to set user-specific options.## In this file, you can use all long options that a program supports.# If you want to know which options a program supports, run the program# with the "--help" option.# The following options will be passed to all MySQL clients
[client]
#password = your_password
port = 3306
socket = /tmp/mysql.sock
# Here follows entries for some specific programs
[mysqldump]
quick
max_allowed_packet = 64M
[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL#safe-updates
[isamchk]
key_buffer = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M
[myisamchk]
key_buffer = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M
[mysqlhotcopy]
interactive-timeout
[mysqld]
port=3306
explicit_defaults_for_timestamp = TRUE
# 服务端使用的字符集默认为8比特编码的latin1字符集
character-set-server=utf8
# 创建新表时将使用的默认存储引擎default-storage-engine=INNODB
#日志#general_log=ON#general_log_file=D:/mysql-5.6.24-win32-WyServer/logs/sql_row.log# 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%.# 优化参数
max_allowed_packet = 64M
# Order By 或者Group By等结果集设置
max_heap_table_size=256M
tmp_table_size=256M
#缓存innodb表的索引,数据,插入数据时的缓冲,尽可能的使用内存缓存,对于MySQL专用服务器,通常设置操作系统内存的70%-80%最佳,但需要注意几个问题,不能导致system的swap空间被占用,要考滤你的系统使用多少内存,其它应用使用的内在,还有你的DB有没有myisa引擎,最后减去这些才是合理的值
innodb_buffer_pool_size = 1024M
#MySQL最大连接数,这个通常在1000-3000之间比较合适,根据系统硬件能力,需要对Linux打开的最大文件数做修改
max_connections =2100#innodb_additional_mem_pool_size除了缓存表数据和索引外,可以为操作所需的其他内部项分配缓存来提升InnoDB的性能。这些内存就可以通过此参数来分配。推荐此参数至少设置为2MB,实际上,是需要根据项目的InnoDB表的数目相应地增加
innodb_additional_mem_pool_size=16M
#innodb_max_dirty_pages_pct值的争议,如果值过大,内存也很大或者服务器压力很大,那么效率很降低,如果设置的值过小,那么硬盘的压力会增加.
innodb_max_dirty_pages_pct=90#控制是否开启结果集缓存,默认0不开启,1开启
query_cache_type =0#query_cache_limit 表示缓存的Select结果集的最大字节数,这个可以限制哪些结果集缓存,16M
query_cache_limit=16777216#总共用多少内存缓存Select结果集的数量,2G个
query_cache_size = 2147483648#表示结果集缓存的内存单元大小
query_cache_min_res_unit=1024#表空间优化,每个表一个表空间,不使用共享空间
innodb_file_per_table=1
innodb_open_files=1024
table_open_cache=1024#InnoDB的日志相关的优化选项#innodb_log_buffer_size这是 InnoDB 存储引擎的事务日志所使用的缓冲区。类似于 Binlog Buffer,InnoDB 在写事务日志#的时候,为了提高性能,也是先将信息写入 Innofb Log Buffer 中,当满足 innodb_flush_log_trx_commit 参数所设置的#相应条件(或者日志缓冲区写满)之后,才会将日志写到文件(或者同步到磁盘)中。innodb_log_buffer_size 不用太大,因为#很快就会写入磁盘。innodb_flush_log_trx_commit的值有0:log buffer中的数据将以每秒一次的频率写入到log file中,#且同时会进行文件系统到磁盘的同步操作1:在每次事务提交的时候将log buffer 中的数据都会写入到log file,同时也会#触发文件系统到磁盘的同步; 2:事务提交会触发log buffer 到log file的刷新,但并不会触发磁盘文件系统到磁盘的同#步。此外,每秒会有一次文件系统到磁盘同步操作。对于非关键交易型数据,采用2即可以满足高性能的日志操作,若要非常#可靠的数据写入保证,则需要设置为1,此时每个commit都导致一次磁盘同步,性能下降。#innodb_log_file_size此参数确定数据日志文件的大小,以M为单位,更大的设置可以提高性能,但也会增加恢复故障数据库#所需的时间。innodb_log_files_in_group分割多个日志文件,提升并行性。innodb_autoextend_increment对于大批量插入#数据也是比较重要的优化参数(单位是M)
innodb_log_buffer_size=16M
innodb_log_file_size =256M
innodb_log_files_in_group=8
innodb_autoextend_increment=128
innodb_flush_log_at_trx_commit=2# Remove leading # to turn on a very important data integrity option: logging# changes to the binary log between backups.# log_bin# 主服务器配置主从复制#server-id=1#log_bin=mysql-bin#binlog-ignore-db=mysql,information_schema,performance_schema# 从服务器配置主从复制#server-id=2#relay-log=mysql-relay-bin#log-slave=updates#read-only=1#replicate-ignore-db=mysql,information_schema,performance_schema# These are commonly set, remove the # and set as required.# basedir = .....# datadir = .....# port = .....# 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