您好,欢迎访问一九零五行业门户网

MySQL Query Cache(缓存)_MySQL

bitscn.com
mysql query cache(缓存)
sql代码    www.bitscn.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客户端库初始化的时候指定这些选项
[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 to master_host=, master_port=,  
#    master_user=, master_password= ;  
#  
#    where you replace , , by quoted strings and  
#     by the master's port number (3306 by default).  
#  
#    example:  
#  
#    change master to master_host='125.564.12.1', master_port=3306,  
#    master_user='joe', master_password='secret';  
#  
# or  
#  
# 2) set the variables below. however, in case you choose this method, then  
#    start replication for the first time (even unsuccessfully, for example  
#    if you mistyped the password in master-password and the slave fails to  
#    connect), the slave will create a master.info file, and any later  
#    change in this file to the variables' values below will be ignored and  
#    overridden by the content of the master.info file, unless you shutdown  
#    the slave server, delete master.info and restart the slaver server.  
#    for that reason, you may want to leave the lines below untouched  
#    (commented) and instead use change master to (see above)  
#  
# required unique id between 2 and 2^32 - 1  
# (and different from the master)  
# defaults to 2 if master-host is set  
# but will not function as a slave if omitted  
#server-id       = 2  
#  
# the replication master for this slave - required  
#master-host     =    
#  
# the username the slave will use for authentication when connecting  
# to the master - required  
#master-user     =    
#  
# the password the slave will authenticate with when connecting to  
# the master - required  
#master-password =    
#  
# the port the master is listening on.  
# optional - defaults to 3306  
#master-port     =    
#  
# binary logging - not required for slaves, but recommended  
#log-bin=mysql-bin
# point the following paths to different dedicated disks  
#tmpdir     = /tmp/       
#log-update     = /path-to-dedicated-directory/hostname
# uncomment the following if you are using innodb tables  
#innodb_data_home_dir = c:/mysql/data/
# # innodb 将数据保存在一个或者多个数据文件中成为表空间.  
# # 如果你只有单个逻辑驱动保存你的数据,一个单个的自增文件就足够好了.  
# # 其他情况下.每个设备一个文件一般都是个好的选择.  
# # 你也可以配置innodb来使用裸盘分区 - 请参考手册来获取更多相关内容  
innodb_data_file_path = ibdata1:10m:autoextend
#innodb_log_group_home_dir = c:/mysql/data/  
# you can set .._buffer_pool_size up to 50 - 80 %  
# of ram but beware of setting memory usage too high  
# # innodb使用一个缓冲池来保存索引和原始数据, 不像 myisam.  
# # 这里你设置越大,你在存取表里面数据时所需要的磁盘i/o越少.  
# # 在一个独立使用的数据库服务器上,你可以设置这个变量到服务器物理内存大小的80%  
# # 不要设置过大,否则,由于物理内存的竞争可能导致操作系统的换页颠簸.  
# # 注意在32位系统上你每个进程可能被限制在 2-3.5g 用户层面内存限制,  
# # 所以不要设置的太高.  
innodb_buffer_pool_size = 64m
# # 附加的内存池被innodb用来保存 metadata 信息  
# # 如果innodb为此目的需要更多的内存,它会开始从os这里申请内存.  
# # 由于这个操作在大多数现代操作系统上已经足够快, 你一般不需要修改此值.  
# # show innodb status 命令会显示当先使用的数量.  
innodb_additional_mem_pool_size = 2m
# set .._log_file_size to 25 % of buffer pool size  
# # 在日志组中每个日志文件的大小.  
# # 你应该设置日志文件总合大小到你缓冲池大小的25%~100%  
# # 来避免在日志文件覆写上不必要的缓冲池刷新行为.  
# # 不论如何, 请注意一个大的日志文件大小会增加恢复进程所需要的时间.  
innodb_log_file_size = 32m
# # 用来缓冲日志数据的缓冲区的大小.  
# # 当此值快满时, innodb将必须刷新数据到磁盘上.  
# # 由于基本上每秒都会刷新一次,所以没有必要将此值设置的太大(甚至对于长事务而言)  
innodb_log_buffer_size = 8m  
# # 如果设置为1 ,innodb会在每次提交后刷新(fsync)事务日志到磁盘上,  
# # 这提供了完整的acid行为.  
# # 如果你愿意对事务安全折衷, 并且你正在运行一个小的食物, 你可以设置此值到0或者2来减少由事务日志引起的磁盘i/o  
# # 0代表日志只大约每秒写入日志文件并且日志文件刷新到磁盘.  
# # 2代表日志写入日志文件在每次提交后,但是日志文件只有大约每秒才会刷新到磁盘上.  
innodb_flush_log_at_trx_commit = 1
# # 在被回滚前,一个innodb的事务应该等待一个锁被批准多久.  
# # innodb在其拥有的锁表中自动检测事务死锁并且回滚事务.  
# # 如果你使用 lock tables 指令, 或者在同样事务中使用除了innodb以外的其他事务安全的存储引擎    www.bitscn.com  
# # 那么一个死锁可能发生而innodb无法注意到.  
# # 这种情况下这个timeout值对于解决这种问题就非常有帮助.  
innodb_lock_wait_timeout = 50
#————————自定义设置——————————  
# 设置mysql的安装目录   
basedir=c:/program files/mysql
# 设置mysql数据库的数据的存放目录,必须是data,或者是/xxx-data   
datadir=c:/program files/mysql/data
# 设置mysql服务器的字符集,默认编码  
default-character-set=utf8
#还原数据库的sql文件如果包含视图与存储结构,需要添加  
#log-bin-trust-function-creators=1
#通过以下语句更改默认存储引擎innodb  
default-storage-engine=innodb
#innodb存储引擎独享表空间  
innodb_file_per_table=1
# # 我们在cache中保留多少线程用于重用  
# # 当一个客户端断开连接后,如果cache中的线程还少于thread_cache_size,  
# # 则客户端线程被放入cache中.  
# # 这可以在你需要大量新连接的时候极大的减少线程创建的开销  
# # (一般来说如果你有好的线程模型的话,这不会有明显的性能提升.)    www.bitscn.com  
thread_cache_size = 8  
[mysqldump]  
quick  
max_allowed_packet = 16m
[mysql]  
no-auto-rehash  
# remove the next comment character if you are not familiar with sql  
#safe-updates
[myisamchk]  
key_buffer_size = 20m  
sort_buffer_size = 20m  
read_buffer = 2m  
write_buffer = 2m
[mysqlhotcopy]  
interactive-timeout
[winmysqladmin]   
# 指定mysql服务启动启动的文件  
server=c:/program files/mysql/bin/mysqld.exe
注册mysql服务的方法: 
修改相应路径,在cmd下运行 
d:/program files/mysql-5.5.14-win32/bin/mysqld.exe  --install mysql --defaults-file=d:/program files/mysql-5.5.14-win32/my.ini
bitscn.com
其它类似信息

推荐信息