-
2021-02-19 14:49:59
my.ini文件位置
1、在我们的电脑上面找到mysql的安装路径,点击进去之后可以看到my.ini在mysql安装路径的根目录 2、另外一种情况是我们在mysql安装目录找不到,看到了my-default.ini文件或者也没有,这时my.ini在“C:\ProgramData\MySQL\MySQL Server x.x”目录下面,我们首先需要找到ProgramData文件夹,这是一个隐藏文件,需要隐藏文件可见才行,或者可以直接检索 我们可以看到在“C:\ProgramData\MySQL\MySQL Server x.x”目录下面找到了my.ini文件
配置参数
[client] port = 3306 #客户端端口号为3306 socket =/data/3306/mysql.sock # default-character-set = utf8 #客户端字符集,(控制character_set_client、character_set_connection、character_set_results) [mysql] no-auto-rehash #仅仅允许使用键值的updates和deletes [mysqld] #组包括了mysqld服务启动的参数,它涉及的方面很多,其中有MySQL的目录和文件,通信、网络、信息安全,内存管理、优化、查询缓存区,还有MySQL日志设置等。 user = mysql #mysql_safe脚本使用MySQL运行用户(编译时--user=mysql指定),推荐使用mysql用户。 port = 3306 #MySQL服务运行时的端口号。建议更改默认端口,默认容易遭受攻击。 socket =/data/3306/mysql.sock #socket文件是在Linux/Unix环境下特有的,用户在Linux/Unix环境下客户端连接可以不通过TCP/IP网络而直接使用unix socket连接MySQL。 basedir = /application/mysql #mysql程序所存放路径,常用于存放mysql启动、配置文件、日志等 datadir = /data/3306/data #MySQL数据存放文件(极其重要) character-set-server = utf8 #数据库和数据库表的默认字符集。(推荐utf8,以免导致乱码) log-error=/data/3306/mysql_xuliangwei.err #mysql错误日志存放路径及名称(启动出现错误一定要看错误日志,百分之百都能通过错误日志排插解决。) pid-file=/data/3306/mysql_xuliangwei.pid #MySQL_pid文件记录的是当前mysqld进程的pid,pid亦即ProcessID。 skip-locking #避免MySQL的外部锁定,减少出错几率,增强稳定性。 skip-name-resolv #禁止MySQL对外部连接进行DNS解析,使用这一选项可以消除MySQL进行DNS解析的时候。但是需要注意的是,如果开启该选项,则所有远程主机连接授权都要使用IP地址方式了,否则MySQL将无法正常处理连接请求! skip-networking #开启该选项可以彻底关闭MySQL的TCP/IP连接方式,如果Web服务器是以远程连接的方式访问MySQL数据库服务器的,则不要开启该选项,否则无法正常连接! open_files_limit = 1024 #MySQLd能打开文件的最大个数,如果出现too mant openfiles之类的就需要调整该值了。 back_log = 384 #back_log参数是值指出在MySQL暂时停止响应新请求之前,短时间内的多少个请求可以被存在堆栈中。如果系统在短时间内有很多连接,则需要增加该参数的值,该参数值指定到来的TCP/IP连接的监听队列的大小。不同的操作系统在这个队列的大小上有自己的限制。如果试图将back_log设置得高于操作系统的限制将是无效的,其默认值为50.对于Linux系统而言,推荐设置为小于512的整数。 max_connections = 800 #指定MySQL允许的最大连接进程数。如果在访问博客时经常出现 Too Many Connections的错误提示,则需要增大该参数值。 max_connect_errors = 6000 #设置每个主机的连接请求异常中断的最大次数,当超过该次数,MySQL服务器将禁止host的连接请求,直到MySQL服务器重启或通过flush hosts命令清空此host的相关信息。 wait_timeout = 120 #指定一个请求的最大连接时间,对于4GB左右内存的服务器来说,可以将其设置为5~10。 table_cache = 614K #table_cache指示表高速缓冲区的大小。当MySQL访问一个表时,如果在MySQL缓冲区还有空间,那么这个表就被打开并放入表缓冲区,这样做的好处是可以更快速地访问表中的内容。一般来说,可以查看数据库运行峰值时间的状态值Open_tables和Open_tables,用以判断是否需要增加table_cache的值,即如果Open_tables接近table_cache的时候,并且Opened_tables这个值在逐步增加,那就要考虑增加这个值的大小了。 external-locking = FALSE #MySQL选项可以避免外部锁定。True为开启。 max_allowed_packet =16M #服务器一次能处理最大的查询包的值,也是服务器程序能够处理的最大查询 sort_buffer_size = 1M #设置查询排序时所能使用的缓冲区大小,系统默认大小为2MB。 注意:该参数对应的分配内存是每个连接独占的,如果有100个连接,那么实际分配的总排序缓冲区大小为100 x6=600MB。所以,对于内存在4GB左右的服务器来说,推荐将其设置为6MB~8MB join_buffer_size = 8M #联合查询操作所能使用的缓冲区大小,和sort_buffer_size一样,该参数对应的分配内存也是每个连接独享。 thread_cache_size = 64 #设置Thread Cache池中可以缓存的连接线程最大数量,可设置为0~16384,默认为0.这个值表示可以重新利用保存在缓存中线程的数量,当断开连接时如果缓存中还有空间,那么客户端的线程将被放到缓存中;如果线程重新被请求,那么请求将从缓存中读取,如果缓存中是空的或者是新的请求,那么这个线程将被重新创建,如果有很多线程,增加这个值可以改善系统性能。通过比较Connections和Threads_created状态的变量,可以看到这个变量的作用。我们可以根据物理内存设置规则如下:1GB内存我们配置为8,2GB内存我们配置为16,3GB我们配置为32,4GB或4GB以上我们给此值为64或更大的值。 thread_concurrency = 8 #该参数取值为服务器逻辑CPU数量x 2,在本例中,服务器有两个物理CPU,而每个物理CPU又支持H.T超线程,所以实际取值为4 x 2 = 8。这也是双四核主流服务器的配置。 query_cache_size = 64M #指定MySQL查询缓冲区的大小。可以通过在MySQL控制台观察,如果Qcache_lowmem_prunes的值非常大,则表明经常出现缓冲不够的情况;如果Qcache_hits的值非常大,则表明查询缓冲使用得非常频繁。另外如果改值较小反而会影响效率,那么可以考虑不用查询缓冲。对于Qcache_free_blocks,如果该值非常大,则表明缓冲区中碎片很多。 query_cache_limit = 2M #只有小于此设置值的结果才会被缓存 query_cache_min_res_unit = 2k #设置查询缓存分配内存的最小单位,要适当第设置此参数,可以做到为减少内存快的申请和分配次数,但是设置过大可能导致内存碎片数值上升。默认值为4K,建议设置为1K~16K。 default_table_type = InnoDB #默认表的类型为InnoDB thread_stack = 256K #设置MySQL每个线程的堆栈大小,默认值足够大,可满足普通操作。可设置范围为128KB至4GB,默认为192KB #transaction_isolation = Level #数据库隔离级别 (READ UNCOMMITTED(读取未提交内容) READ COMMITTED(读取提交内容) REPEATABLE READ(可重读) SERIALIZABLE(可串行化)) tmp_table_size = 64M #设置内存临时表最大值。如果超过该值,则会将临时表写入磁盘,其范围1KB到4GB。 max_heap_table_size = 64M #独立的内存表所允许的最大容量。 table_cache = 614 #给经常访问的表分配的内存,物理内存越大,设置就越大。调大这个值,一般情况下可以降低磁盘IO,但相应的会占用更多的内存,这里设置为614。 table_open_cache = 512 #设置表高速缓存的数目。每个连接进来,都会至少打开一个表缓存。因此,table_cache 的大小应与 max_connections 的设置有关。例如,对于200 个并行运行的连接,应该让表的缓存至少有 200 × N ,这里 N 是应用可以执行的查询的一个联接中表的最大数量。此外,还需要为临时表和文件保留一些额外的文件描述符。 long_query_time = 1 #慢查询的执行用时上限,默认设置是10s,推荐(1s~2s) log_long_format #没有使用索引的查询也会被记录。(推荐,根据业务来调整) log-slow-queries = /data/3306/slow.log #慢查询日志文件路径(如果开启慢查询,建议打开此日志) log-bin = /data/3306/mysql-bin #logbin数据库的操作日志,例如update、delete、create等都会存储到binlog日志,通过logbin可以实现增量恢复 relay-log = /data/3306/relay-bin #relay-log日志记录的是从服务器I/O线程将主服务器的二进制日志读取过来记录到从服务器本地文件,然后SQL线程会读取relay-log日志的内容并应用到从服务器 relay-log-info-file = /data/3306/relay-log.info #从服务器用于记录中继日志相关信息的文件,默认名为数据目录中的relay-log.info。 binlog_cache_size = 4M #在一个事务中binlog为了记录sql状态所持有的cache大小,如果你经常使用大的,多声明的事务,可以增加此值来获取更大的性能,所有从事务来的状态都被缓冲在binlog缓冲中,然后再提交后一次性写入到binlog中,如果事务比此值大,会使用磁盘上的临时文件来替代,此缓冲在每个链接的事务第一次更新状态时被创建。 max_binlog_cache_size = 8M #最大的二进制Cache日志缓冲尺寸。 max_binlog_size = 1G #二进制日志文件的最大长度(默认设置1GB)一个二进制文件信息超过了这个最大长度之前,MySQL服务器会自动提供一个新的二进制日志文件接续上。 expire_logs_days = 7 #超过7天的binlog,mysql程序自动删除(如果数据重要,建议不要开启该选项) key_buffer_size = 256M #指定用于索引的缓冲区大小,增加它可得到更好的索引处理性能。对于内存在4GB左右的服务器来说,该参数可设置为256MB或384MB。 注意:如果该参数值设置得过大反而会使服务器的整体效率降低! read_buffer_size = 4M #读查询操作所能使用的缓冲区大小。和sort_buffer_size一样,该参数对应的分配内存也是每个连接独享。 read_rnd_buffer_size = 16M #设置进行随机读的时候所使用的缓冲区。此参数和read_buffer_size所设置的Buffer相反,一个是顺序读的时候使用,一个是随机读的时候使用。但是两者都是针对与线程的设置,每个线程都可以产生两种Buffer中的任何一个。默认值256KB,最大值4GB。 bulk_insert_buffer_size = 8M #如果经常性的需要使用批量插入的特殊语句来插入数据,可以适当调整参数至16MB~32MB,建议8MB。 #myisam_sort_buffer_size = 8M #设置在REPAIR Table或用Create index创建索引或 Alter table的过程中排序索引所分配的缓冲区大小,可设置范围4Bytes至4GB,默认为8MB lower_case_table_names = 1 #实现MySQL不区分大小。(发开需求-建议开启) slave-skip-errors = 1032,1062 #从库可以跳过的错误数字值(mysql错误以数字代码反馈,全的mysql错误代码大全,以后会发布至博客)。 replicate-ignore-db=mysql #在做主从的情况下,设置不需要同步的库。 server-id = 1 #表示本机的序列号为1,如果做主从,或者多实例,serverid一定不能相同。 myisam_sort_buffer_size = 128M #当需要对于执行REPAIR, OPTIMIZE, ALTER 语句重建索引时,MySQL会分配这个缓存,以及LOAD DATA INFILE会加载到一个新表,它会根据最大的配置认真的分配的每个线程。 myisam_max_sort_file_size = 10G #当重新建索引(REPAIR,ALTER,TABLE,或者LOAD,DATA,TNFILE)时,MySQL被允许使用临时文件的最大值。 myisam_repair_threads = 1 #如果一个表拥有超过一个索引, MyISAM 可以通过并行排序使用超过一个线程去修复他们. myisam_recover #自动检查和修复没有适当关闭的 MyISAM 表. innodb_additional_mem_pool_size = 4M #用来设置InnoDB存储的数据目录信息和其他内部数据结构的内存池大小。应用程序里的表越多,你需要在这里面分配越多的内存。对于一个相对稳定的应用,这个参数的大小也是相对稳定的,也没有必要预留非常大的值。如果InnoDB用广了这个池内的内存,InnoDB开始从操作系统分配内存,并且往MySQL错误日志写警告信息。默认为1MB,当发现错误日志中已经有相关的警告信息时,就应该适当的增加该参数的大小。 innodb_buffer_pool_size = 64M #InnoDB使用一个缓冲池来保存索引和原始数据,设置越大,在存取表里面数据时所需要的磁盘I/O越少。强烈建议不要武断地将InnoDB的Buffer Pool值配置为物理内存的50%~80%,应根据具体环境而定。 innodb_data_file_path = ibdata1:128M:autoextend #设置配置一个可扩展大小的尺寸为128MB的单独文件,名为ibdata1.没有给出文件的位置,所以默认的是在MySQL的数据目录内。 innodb_file_io_threads = 4 #InnoDB中的文件I/O线程。通常设置为4,如果是windows可以设置更大的值以提高磁盘I/O innodb_thread_concurrency = 8 #你的服务器有几个CPU就设置为几,建议用默认设置,一般设为8。 innodb_flush_log_at_trx_commit = 1 #设置为0就等于innodb_log_buffer_size队列满后在统一存储,默认为1,也是最安全的设置。 innodb_log_buffer_size = 2M #默认为1MB,通常设置为8~16MB就足够了。 innodb_log_file_size = 32M #确定日志文件的大小,更大的设置可以提高性能,但也会增加恢复数据库的时间。 innodb_log_files_in_group = 3 #为提高性能,MySQL可以以循环方式将日志文件写到多个文件。推荐设置为3。 innodb_max_dirty_pages_pct = 90 #InnoDB主线程刷新缓存池中的数据。 innodb_lock_wait_timeout = 120 #InnoDB事务被回滚之前可以等待一个锁定的超时秒数。InnoDB在它自己的锁定表中自动检测事务死锁并且回滚事务。InnoDB用locak tables 语句注意到锁定设置。默认值是50秒。 innodb_file_per_table = 0 #InnoDB为独立表空间模式,每个数据库的每个表都会生成一个数据空间。0关闭,1开启。 [mysqldump] quick max_allowed_packet = 2M #设定在网络传输中一次消息传输量的最大值。系统默认值为1MB,最大值是1GB,必须设置为1024的倍数。单位为字节。
更多相关内容 -
mysql的配置文件my.ini
2020-04-14 22:37:50mysql的初始化配置文件内容 [mysqld] # 设置3306端口 port=3306 # 设置mysql的安装目录 basedir=D:/mysql-8.0.19-winx64/mysql-8.0.19-winx64 # 设置mysql数据库的数据的存放目录 datadir=D:/mysql-8.0.19-winx64/... -
MySQL配置文件my.ini内容
2021-03-25 23:21:28my.ini是MySQL配置文件,MySQL服务器每次启动时都会读取该文件,如果需要更改配置,可以修改它。注意修改后必须重启服务修改才生效。该文件在C:\ProgramData\MySQL\MySQL Server 8.0目录下。如图: my.ini文件中的...my.ini是MySQL配置文件,MySQL服务器每次启动时都会读取该文件,如果需要更改配置,可以修改它。注意修改后必须重启服务修改才生效。该文件在C:\ProgramData\MySQL\MySQL Server 8.0目录下。如图:
my.ini文件中的内容介绍:([client]和[mysql]都是客户端,[mysqld]是服务器端)
-
win10 mysql8 my.ini配置文件
2021-01-21 14:33:20my.ini配置文件的内容如何配置 一、my.ini配置文件的路径:面向已经安装好mysql的用户 找到mysql的环境变量配置路径: 图中,我的配置路径就是:E:\Software\mysql-8.0.19-winx64,有的是在Mysql的bin目录下,这都... -
mysql5.7以上版本配置my.ini的详细步骤
2020-09-09 00:44:50主要为大家详细介绍了mysql5.7以上版本配置my.ini的详细步骤,文中每一步介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们可以参考一下 -
mysql配置文件 my.ini
2020-04-22 17:17:25my.ini是MySQL数据库中使用的配置文件,修改这个文件可以达到更新配置的目的。修改my.ini文件后需要重启数据库 -
mysql的my.ini配置文件
2018-09-03 17:51:50资源就是mysql的my.ini文件,有需要和参考的可以下来看看,mysql的安装卸载文章在https://blog.csdn.net/qq_40342174/article/details/82352162 -
mysql 5.7 windows 默认my.ini
2020-05-26 00:08:50mysql 5.7 windows 默认my.ini 配置文件有英文注释,可做配置参考。linux下可参考使用 win10 安装配置 mysql 5.7 zip版 https://blog.csdn.net/haveqing/article/details/106355576 -
mysql 数据库 my.ini 配置文件
2019-03-21 13:44:57MySQL 数据库 my.ini 配置文件 。以及MySQL 安装步骤以及使用说明。创建数据库,修改密码 -
mysql8.0 my.ini设置文件
2019-02-13 22:18:23mysql8.0.13 my.ini设置文件 Windows下的配置文件直接可用 -
Mysql my.ini 配置文件详解
2021-01-19 22:23:40Mysql my.ini 配置文件详解 #BEGIN CONFIG INFO #DESCR: 4GB RAM, 只使用InnoDB, ACID, 少量的连接, 队列负载大 #TYPE: SYSTEM #END CONFIG INFO # # 此mysql配置文件例子针对4G内存 # 主要使用INNODB #处理复杂队列... -
MySql 免安装 my.ini配置文件下载
2018-08-22 15:03:06配置mysql环境变量 下载后自己修改路径 basedir=D:\mysql-5.6.24-win32 datadir=D:\mysql-5.6.24-win32\data 在mysql的bin目录下执行 安装mysql服务,执行mysqld -install 启动服务: net start mysql 停止服务... -
MySQL 5.6 & 5.7最优配置文件模板(my.ini)
2018-02-18 16:45:30整理了一份最新基于MySQL 5.6和5.7的配置文件模板,基本上可以说覆盖90%的调优选项,用户只需根据自己的服务器配置稍作修改即可,如InnoDB缓冲池的大小、IO能力(innodb_buffer_pool_size,innodb_io_capacity)。... -
Mysql my.ini 配置文件详解.txt
2017-12-10 13:50:05Mysql my.ini 配置文件详解 每一步都非常详细哟,,, -
my.ini(mysql8.0.13 my.ini设置文件 Windows下的配置文件直接可用)
2019-09-09 17:45:03安装MySQL配置文件 mysql8.0.13 my.ini设置文件 Windows下的配置文件直接可用 -
mysql 8.0 windows 默认my.ini
2020-05-27 00:32:50mysql 8.0 windows 默认my.ini 配置文件有英文解释,可做配置参考。linux下可参考使用 win10 安装配置 mysql 8.0 MSI版 https://blog.csdn.net/haveqing/article/details/106355632 -
mysql配置文件my.ini
2021-11-09 08:23:55my.ini就是mysql的配置文件,打开可以进行修改诸如默认端口号3306、查看当前sql的安装路径等信息 注意:修改完后,需要在【服务】中重启mysql服务,才能生效my.ini就是mysql的配置文件,打开可以进行修改诸如默认端口号3306、查看当前sql的安装路径等信息
注意:修改完后,需要在【服务】中重启mysql服务,才能生效
-
mysql中my.ini配置
2017-09-12 10:25:02mysql中my.ini配置文件 my.ini配置 -
MySQL配置文件my.ini详解
2021-05-24 07:12:23my.ini是MySQL数据库中使用的配置文件,修改这个文件可以达到更新配置的目的。 my.ini 在哪放着呢? my.ini存放在MySql安装的根目录,如图所示:(我比较懒,用的WAMP,大家找自己的安装目录即可) my.ini的配置...my.ini 是啥玩意?
my.ini是MySQL数据库中使用的配置文件,修改这个文件可以达到更新配置的目的。
my.ini 在哪放着呢?
my.ini存放在MySql安装的根目录,如图所示:(我比较懒,用的WAMP,大家找自己的安装目录即可)
my.ini的配置内容介绍:
其实大体可以分为两部分:客户端的参数、服务器参数。其中服务器参数里还包括 InnoDB存储引擎参数。
客户端的参数
下面显示的是客户端的参数,[client]和[mysql]都是客户端,下面是参数简介:
-
port
参数表示的是MySQL数据库的端口,默认的端口是3306,如果你需要更改端口号的话,就可以通过在这里修改。 -
default-character-set
参数是客户端默认的字符集,如果你希望它支持中文,可以设置成gbk或者utf8。 -
这里还有一个
password
参数,在这里设置了password参数的值就可以在登陆时不用输入密码直接进入
# CLIENT SECTION # ---------------------------------------------------------------------- # # The following options will be read by MySQL client applications. # Note that only client applications shipped by MySQL are guaranteed # to read this section. If you want your own MySQL client program to # honor these values, you need to specify it as an option during the # MySQL client library initialization. # [client] port=3306 [mysql] default-character-set=gb2312
服务器断参数:
以下是参数的介绍:
-
port
参数也是表示数据库的端口。 -
basedir
参数表示MySQL的安装路径。 -
datadir
参数表示MySQL数据文件的存储位置,也是数据库表的存放位置。 -
default-character-set
参数表示默认的字符集,这个字符集是服务器端的。 -
default-storage-engine
参数默认的存储引擎。
这里有两个引擎 MyISAM 和 InnoDB ,用什么看你需求,详细介绍可以参考下面这篇博文:https://yangyongli.blog.csdn.net/article/details/117213310 -
sql-mode
参数表示SQL模式的参数,通过这个参数可以设置检验SQL语句的严格程度。 -
max_connections
参数表示允许同时访问MySQL服务器的最大连接数,其中一个连接是保留的,留给管理员专用的。 -
query_cache_size
参数表示查询时的缓存大小,缓存中可以存储以前通过select语句查询过的信息,再次查询时就可以直接从缓存中拿出信息。 -
table_cache
参数表示所有进程打开表的总数。 -
tmp_table_size
参数表示内存中临时表的总数。 -
thread_cache_size
参数表示保留客户端线程的缓存。 -
myisam_max_sort_file_size
参数表示MySQL重建索引时所允许的最大临时文件的大小。 -
myisam_sort_buffer_size
参数表示重建索引时的缓存大小。 -
key_buffer_size
参数表示关键词的缓存大小。 -
read_buffer_size
参数表示MyISAM表全表扫描的缓存大小。 -
read_rnd_buffer_size
参数表示将排序好的数据存入该缓存中。 -
sort_buffer_size
参数表示用于排序的缓存大小
# SERVER SECTION # ---------------------------------------------------------------------- # # The following options will be read by the MySQL Server. Make sure that # you have installed the server correctly (see above) so it reads this # file. # [mysqld] # The TCP/IP Port the MySQL Server will listen on port=3306 #Path to installation directory. All paths are usually resolved relative to this. basedir="E:/Java/Mysql/" #Path to the database root datadir="C:/ProgramData/MySQL/MySQL Server 5.5/Data/" # The default character set that will be used when a new schema or table is # created and no character set is defined character-set-server=gb2312 # The default storage engine that will be used when create new tables when default-storage-engine=INNODB # Set the SQL mode to strict sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION" # The maximum amount of concurrent sessions the MySQL server will # allow. One of these connections will be reserved for a user with # SUPER privileges to allow the administrator to login even if the # connection limit has been reached. max_connections=100 # Query cache is used to cache SELECT results and later return them # without actual executing the same query once again. Having the query # cache enabled may result in significant speed improvements, if your # have a lot of identical queries and rarely changing tables. See the # "Qcache_lowmem_prunes" status variable to check if the current value # is high enough for your load. # Note: In case your tables change very often or if your queries are # textually different every time, the query cache may result in a # slowdown instead of a performance improvement. query_cache_size=0 # The number of open tables for all threads. Increasing this value # increases the number of file descriptors that mysqld requires. # Therefore you have to make sure to set the amount of open files # allowed to at least 4096 in the variable "open-files-limit" in # section [mysqld_safe] table_cache=256 # Maximum size for internal (in-memory) temporary tables. If a table # grows larger than this value, it is automatically converted to disk # based table This limitation is for a single table. There can be many # of them. tmp_table_size=35M # How many threads we should keep in a cache for reuse. When a client # disconnects, the client's threads are put in the cache if there aren't # more than thread_cache_size threads from before. This greatly reduces # the amount of thread creations needed if you have a lot of new # connections. (Normally this doesn't give a notable performance # improvement if you have a good thread implementation.) thread_cache_size=8 #*** MyISAM Specific options # The maximum size of the temporary file MySQL is allowed to use while # recreating the index (during REPAIR, ALTER TABLE or LOAD DATA INFILE. # If the file-size would be bigger than this, the index will be created # through the key cache (which is slower). myisam_max_sort_file_size=100G # If the temporary file used for fast index creation would be bigger # than using the key cache by the amount specified here, then prefer the # key cache method. This is mainly used to force long character keys in # large tables to use the slower key cache method to create the index. myisam_sort_buffer_size=69M # Size of the Key Buffer, used to cache index blocks for MyISAM tables. # Do not set it larger than 30% of your available memory, as some memory # is also required by the OS to cache rows. Even if you're not using # MyISAM tables, you should still set it to 8-64M as it will also be # used for internal temporary disk tables. key_buffer_size=55M # Size of the buffer used for doing full table scans of MyISAM tables. # Allocated per thread, if a full scan is needed. read_buffer_size=64K read_rnd_buffer_size=256K # This buffer is allocated when MySQL needs to rebuild the index in # REPAIR, OPTIMZE, ALTER table statements as well as in LOAD DATA INFILE # into an empty table. It is allocated per thread so be careful with # large settings. sort_buffer_size=256K
InnoDB存储引擎使用的参数:
以下是参数的简介:
-
innodb_additional_mem_pool_size
参数表示附加的内存池,用来存储InnoDB表的内容。 -
innodb_flush_log_at_trx_commit
参数是设置提交日志的时机,若设置为1,InnoDB会在每次提交后将事务日志写到磁盘上。 -
innodb_log_buffer_size
参数表示用来存储日志数据的缓存区的大小。 -
innodb_buffer_pool_size
参数表示缓存的大小,InnoDB使用一个缓冲池类保存索引和原始数据。 -
innodb_log_file_size
参数表示日志文件的大小。 -
innodb_thread_concurrency
参数表示在InnoDB存储引擎允许的线程最大数。
#*** INNODB Specific options *** # Use this option if you have a MySQL server with InnoDB support enabled # but you do not plan to use it. This will save memory and disk space # and speed up some things. #skip-innodb # Additional memory pool that is used by InnoDB to store metadata # information. If InnoDB requires more memory for this purpose it will # start to allocate it from the OS. As this is fast enough on most # recent operating systems, you normally do not need to change this # value. SHOW INNODB STATUS will display the current amount used. innodb_additional_mem_pool_size=3M # If set to 1, InnoDB will flush (fsync) the transaction logs to the # disk at each commit, which offers full ACID behavior. If you are # willing to compromise this safety, and you are running small # transactions, you may set this to 0 or 2 to reduce disk I/O to the # logs. Value 0 means that the log is only written to the log file and # the log file flushed to disk approximately once per second. Value 2 # means the log is written to the log file at each commit, but the log # file is only flushed to disk approximately once per second. innodb_flush_log_at_trx_commit=1 # The size of the buffer InnoDB uses for buffering log data. As soon as # it is full, InnoDB will have to flush it to disk. As it is flushed # once per second anyway, it does not make sense to have it very large # (even with long transactions). innodb_log_buffer_size=2M # InnoDB, unlike MyISAM, uses a buffer pool to cache both indexes and # row data. The bigger you set this the less disk I/O is needed to # access data in tables. On a dedicated database server you may set this # parameter up to 80% of the machine physical memory size. Do not set it # too large, though, because competition of the physical memory may # cause paging in the operating system. Note that on 32bit systems you # might be limited to 2-3.5G of user level memory per process, so do not # set it too high. innodb_buffer_pool_size=107M # Size of each log file in a log group. You should set the combined size # of log files to about 25%-100% of your buffer pool size to avoid # unneeded buffer pool flush activity on log file overwrite. However, # note that a larger logfile size will increase the time needed for the # recovery process. innodb_log_file_size=54M # Number of threads allowed inside the InnoDB kernel. The optimal value # depends highly on the application, hardware as well as the OS # scheduler properties. A too high value may lead to thread thrashing. innodb_thread_concurrency=18
中文翻译版 my.ini
[client] port=3306 [mysql] default-character-set=gbk [mysqld] port = 3306 socket = /tmp/mysql.sock # 设置mysql的安装目录 basedir=F:\\Hzq Soft\\MySql Server 51GA # 设置mysql数据库的数据的存放目录,必须是data,或者是\\xxx-data datadir=F:\\Hzq Soft\\MySql Server 51GA\\data #innodb_log_arch_dir 默认datadir #innodb_log_group_home_dir 默认datadir # 设置mysql服务器的字符集,默认编码 default-character-set=utf8 #连接数的操作系统监听队列数量,如果经常出现“拒绝连接”错误可适当增加此值 back_log = 50 #不使用接听TCP / IP端口方法,mysqld通过命名管道连接 #skip-networking # 最大连接数量 max_connections = 90 #打开表的线程数量限定,最大4096,除非用mysqld_safe打开限制 table_open_cache = 2048 #MySql 服务接收针对每个进程最大查询包大小 max_allowed_packet = 16M #作用于SQL查询单笔处理使用的内存缓存,如果一笔操作的二进制数据超过了限定大小,将会在磁盘上开辟空间处理,一般设为 1-2M即可,默认1M binlog_cache_size = 2M #单个内存表的最大值限定 max_heap_table_size = 64M #为每个线程分配的排序缓冲大小 sort_buffer_size = 8M #join 连表操作的缓冲大小,根据实际业务来设置,默认8M join_buffer_size = 32M #操作多少个离开连接的线程的缓存 thread_cache_size = 8 #并发线程数量,默认为8,可适当增加到2倍以内。如果有多个CPU可以乘 上CPU的数量。双核CPU可以乘 上当前最核数再乘 上70%-85% thread_concurrency = 16 #专用于具体SQL的缓存,如果提交的查询与几次中的某查询相同,并且在query缓存中存在,则直接返回缓存中的结果。 query_cache_size = 64M #对应上一条设置,当查询的结果超过下面设置的大小时,将不会趣入到上面设置的缓存区中,避免了一个大的结果占据大量缓存。 query_cache_limit = 2M #设置加全文检索中的最小单词长度。 #ft_min_word_len = 4 #CREATE TABLE 语句的默认表类型,如果不自己指定类型,则使用下行的类型 default-storage-engine = InnoDB #线程堆栈大小,mysql说它自己用的堆栈大小不超过64K。这个值可适当设高一点(在RCA的项目中都是共用同一个数据库连接的),默认192K thread_stack = 800K #设置事务处理的级别,默认 REPEATABLE-READ,一般用它就即可,以下二行按顺序对应, #可读写未提交的数据,创建未提交的数据副本读写,未提交之前可读不可写,只允许串行序列招行事务。 # READ-UNCOMMITTED, READ-COMMITTED, REPEATABLE-READ, SERIALIZABLE transaction_isolation = REPEATABLE-READ #单一内存临时表在内存中的大小,超过此值自动转换到磁盘操作 tmp_table_size = 64M #启动二进制日志功能,可通过它实现时间点恢复最新的备份 #log-bin=mysql-bin #二进制日志格式,对就上一条,-建议混合格式 #binlog_format=mixed #转换查询为缓慢查询 slow_query_log #对应上一条,如果一个查询超过了下条设定的时间则执行上一条。 long_query_time = 2 #自定义主机ID识别符,用于主从或多服务器之间识别,为 一个 int 类型 server-id = 1 #一般用来缓存MyISAM表的主键,也用于临时的磁盘表缓存主键,上面多次出现临时磁盘表,所以就算不用MyISAM也最好为其设置一个不小的值,默认32M key_buffer_size = 56M #全表扫描MyISAM表时的缓存,每个线程拥有下行的大小。 read_buffer_size = 2M #排序操作时与磁盘之间的缓存,分到每个线程,默认16M read_rnd_buffer_size = 16M #MyISAM使用特殊树形进行批量插入时的缓存,如insert ... values(..)(..)(..) bulk_insert_buffer_size = 64M #MyISAM索引文件的最大限定, myisam_max_sort_file_size = 12G #如果一个myisam表有一个以上的索引, MyISAM可以使用一个以上线程来排序并行它们。较耗硬件资源,如果你的环境不错,可以增加此值。 myisam_repair_threads = 2 #自动检查和修复无法正确关闭MyISAM表。 myisam_recover # *** INNODB Specific options *** #开启下条将会禁用 INNODB #skip-innodb #一般不用设置或者说设了也没多大用,InnoDB会自己与操作系统交互管理其附加内存池所使用InnoDB的存储数据的大小 innodb_additional_mem_pool_size = 16M #innodb整体缓冲池大小,不宜过大,设为本地内存的 50%-75% 比较合适,在本机开发过程中可以设得较小一点如 64M,256M innodb_buffer_pool_size = 256M #InnoDB的数据存储在一个或多个数据文件组成的表空间 innodb_data_file_path = ibdata1:10M:autoextend #用于异步IO操作的线程数量,默认为 4 ,可适当提高 innodb_file_io_threads = 8 #线程数内允许的InnoDB内核,不宜太高 innodb_thread_concurrency = 14 #InnoDB的事务日志快存行为,默认为 1,为0可减轻磁盘I/0操作,还有以为2 innodb_flush_log_at_trx_commit = 1 #InnoDB的用于的缓冲日志数据的大小 innodb_log_buffer_size = 16M #日志文件,可设置为25%-90%的总体缓存大小,默认 256M. 修改此项要先删除datadir\ib_logfileXXX innodb_log_file_size = 256M #日志组数量,默认为3 innodb_log_files_in_group = 3 #InnoDB的日志文件位置。默认是MySQL的datadir #innodb_log_group_home_dir #InnoDB最大允许的脏页缓冲池的百分比,默认90 innodb_max_dirty_pages_pct = 90 #事务死锁超时设定 innodb_lock_wait_timeout = 120 [client] port = 3306 socket = /tmp/mysql.sock # 设置mysql客户端的字符集 default-character-set=utf8 [mysqldump] quick max_allowed_packet = 16M [mysql] no-auto-rehash # Only allow UPDATEs and DELETEs that use keys. #safe-updates [WinMySQLAdmin] # 指定mysql服务启动启动的文件 Server=F:\\myweb\\MySql Server\\bin\\mysqld.exe
-
-
MySql8.0运行时需要的my.ini文件
2020-04-18 15:16:10安装版的MySql运行的时候 出现"服务无法启动 服务没有报告任何错误",j解决办法:在mysql的安装路径(C:\Program Files\MySQL\MySQL Server 8.0)中没有配置文件,则自己手动创建一个,文件名为:my.ini -
MySQL安装配置文件my.ini
2019-12-26 18:31:54通过zip文件解压安装MySQL时需要的配置文件my.ini。 MySQL是一种关系数据库管理系统,关系数据库将数据保存在不同的表中,而不是将所有数据放在一个大仓库内,这样就增加了速度并提高了灵活性。 -
Mysql-my.ini-基础配置(含说明)
2020-06-14 15:47:58Mysql基础的安装配置文件,(basedir)置mysql安装目录,(datadir)设置mysql数据库的数据存放目录 -
如何查找 MySQL配置文件 my.ini (my.conf)的位置(案例篇)
2022-01-07 12:06:38如何查找 MySQL配置文件 my.ini (my.conf)的位置(案例篇) MySQL配置文件说明:【系统不同,后缀有区别】 MySQL配置文件在Windows下叫my.ini,在MySQL的安装根目录下; 在Linux下叫my.cnf,该文件位于/etc/my.... -
Mysql配置文件my.ini配置项详解
2020-06-22 17:41:13可以直接Ctrl+F全局搜索,欢迎大家留言指正补充 #[client] #MySQL默认密码 #password=88888888 ...#指定MySQL的数据库文件放在什么路径下 datadir=/usr/local/mysql/data #mysql以socket方式运行的sock文件位置 so -
Mysql my.ini配置文件
2015-11-06 00:15:56Mysql my.ini配置文件 ,可以正常使用 -
mysql8.0配置文件 my.ini
2021-07-29 10:30:02mysql8.0配置文件my.ini [mysqld] # 设置3306端口 port=3307 # 设置mysql的安装目录 basedir=D:\Program Files (x86)\MySQL\mysql-8.0.26-winx64 # 设置mysql数据库的数据的存放目录 datadir=D:\Program Files (x86)... -
mysql学习笔记整理——my.ini配置文件
2021-03-22 14:54:00my.ini配置文件可以对数据库一些常用配置进行设置,如:engineer、port、character等,因此这个文件也是非常重要的,当然也可以全部使用默认配置的形式。 一、my.ini的位置 这里要特别注意一下,my.ini默认是在mysql...