MySQL Query Cache(缓存)(一)

2014-11-24 13:59:25 · 作者: · 浏览: 0
MySQL Query Cache(缓存)
Sql代码 www.2cto.com
# Example MySQL config file for medium systems.
#通过mysql-5.1.37-win32的my-medium.ini编辑生成,应用与 数据库在一台机器上。
# 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
# # 以下选项会被MySQL客户端应用读取.
# # 注意只有MySQL附带的客户端应用程序保证可以读取这段内容.
# # 如果你想你自己的MySQL应用程序获取这些值
# # 需要在MySQL客户端库初始化的时候指定这些选项 www.2cto.com
[client]
#password = your_password
#mysql客户端默认端口,对于应用来说没有意义,安装程序不对此参数进行修改。
port = 3316
socket = /tmp/mysql.sock
# Here follows entries for some specific programs
# MySQL 服务端
# The MySQL server
[mysqld]
#数据库端口,默认设置为3316,安装程序自动识别端口,在3316,3326,3336,3346中选择可用端口
port = 3316
socket = /tmp/mysql.sock
skip-locking
#MyISAM 相关选项,由于使用存储引擎INNODB,所以此段设置保留默认,不做修改。
# # 关键词缓冲的大小, 一般用来缓冲MyISAM表的索引块.
# # 不要将其设置大于你可用内存的30%,
# # 因为一部分内存同样被OS用来缓冲行数据
# # 甚至在你并不使用MyISAM 表的情况下, 你也需要仍旧设置起 8-64M 内存由于它同样会被内部临时磁盘表使用.
key_buffer_size = 16M
max_allowed_packet = 1M
table_open_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
# # 用来做MyISAM表全表扫描的缓冲大小.
# # 当全表扫描需要时,在对应线程中分配.
read_buffer_size = 256K
# # 当在排序之后,从一个已经排序好的序列中读取行时,行数据将从这个缓冲中读取来防止磁盘寻道.
# # 如果你增高此值,可以提高很多ORDER BY的性能.
# # 当需要时由每个线程分配
read_rnd_buffer_size = 512K
# # 此缓冲当MySQL需要在 REPAIR, OPTIMIZE, ALTER 以及 LOAD DATA INFILE 到一个空表中引起重建索引时被分配.
# # 这在每个线程中被分配.所以在设置大值时需要小心.
myisam_sort_buffer_size = 8M
# Don't listen on a TCP/IP port at all. This can be a security enhancement,
# if all processes that need to connect to mysqld run on the same host.
# All interaction with mysqld must be made via Unix sockets or named pipes.
# Note that using this option without enabling named pipes on Windows
# (via the "enable-named-pipe" option) will render mysqld useless!
#
#skip-networking
# Replication Master Server (default)
# binary logging is required for replication
# # 打开二进制日志功能.
# # 在复制(replication)配置中,作为MASTER主服务器必须打开此项
# # 如果你需要从你最后的备份中做基于时间点的恢复,你也同样需要二进制日志.
log-bin=mysql-bin
# binary logging format - mixed recommended
binlog_format=mixed
# required unique id between 1 and 2^32 - 1
# defaults to 1 if master-host is not set
# but will not function as a master if omitted
# # 唯一的服务辨识号,数值位于 1 到 2^32-1之间.
# # 此值在master和slave上都需要设置.
# # 如果 "master-host" 没有被设置,则默认为1, 但是如果忽略此选项,MySQL不会作为master生效.
server-id = 1
# Replication Slave (comment out master section to use this)
#
# To configure this host as a replication slave, you can choose between
# two methods :
#
# 1) Use the CHANGE MASTER TO command (fully described in our manual) -
# the syntax is:
#
# CHANGE MASTER T