您的位置:首页 > 数据库 > MySQL

mysql中my.cnf的一个配置文件

2013-11-27 08:28 302 查看
# 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)

#

# MySQL programs look for option files in a set of

# locations which depend on the deployment platform.

# You can copy this option file to one of those

# locations. For information about these locations, see:

# http://dev.mysql.com/doc/mysql/en/option-files.html

#

# 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/mysqld.sock

#default-character-set=utf8

# Here follows entries for some specific programs

"/opt/mysql/etc/my.cnf" 162L, 6528C

# Set .._log_file_size to 25 % of buffer pool size

#innodb_log_file_size = 5M

#innodb_log_buffer_size = 8M

#innodb_flush_log_at_trx_commit = 1

#innodb_lock_wait_timeout = 50

[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

"/opt/mysql/etc/my.cnf" 162L, 6528C written

[root@SR3 ~]# more /etc/my.cnf

/etc/my.cnf: No such file or directory

[root@SR3 ~]#

[root@SR3 ~]#

[root@SR3 ~]# more /opt/mysql/etc/my.cnf

# 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)

#

# MySQL programs look for option files in a set of

# locations which depend on the deployment platform.

# You can copy this option file to one of those

# locations. For information about these locations, see:

# http://dev.mysql.com/doc/mysql/en/option-files.html

#

# 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/mysqld.sock

#default-character-set=utf8

# Here follows entries for some specific programs

# The MySQL server

[mysqld]

port = 3306

socket = /tmp/mysqld.sock

skip-external-locking

long_query_time=5

log-slow-queries= /mysqldata/slowquery.log

character_set_server=utf8

default-storage-engine=MyISAM

#have_partition_engine=yes

max_connections =3000 #最大连接数

sort_buffer_size = 16M #在排序发生时由每个线程分配

join_buffer_size = 16M #当全联合发生时,在每个线程分配

query_cache_size = 512M #查询缓冲,可以提高服务器速度

query_cache_limit=100M #只有小于此值的结果才会被缓冲,此设置用来保护查询缓冲,防止一个极大的结果集将其他所有的查询结果都覆盖

tmp_table_size=10M #内部(内存中)临时表的最大大小,如果一个表增长到此值更大,将会自动转换为基于磁盘的表,此限制是针对单个表的,而不是

总和

key_buffer_size=256M #关键词缓冲大小,一般用于缓冲MyISAM表的索引块,不要将其设置大于你可用内存的30%,因为一部分内存同样被OS用来缓冲

行数据,甚至在你并不使用MyISAM表的情况下,你也需要仍旧设置起8-64M内存由于它同样会被内部临时磁盘表使用

#key_buffer_size = 16M

read_buffer_size=32M #用来做MyISAM表全表扫描的缓冲大小,当全表扫描需要时,在对应线程中分配

read_rnd_buffer_size=64 #当在排序之后,从一个已经排序好的序列中读取行时,行数据将从这个缓冲中读取来防止磁盘寻道.如果你增高此值,可以提

高很多ORDER BY的性能.当需要时由每个线程分配

bulk_insert_buffer_size = 128M #MyISAM 使用特殊的类似树的cache来使得突发插入,(这些插入是,INFILE) 更快. 此变量限制每个进程中缓冲树的

字节数.设置为 0 会关闭此优化,为了最优化不要将此值设置大于 “key_buffer_size”.

max_allowed_packet = 1M

table_open_cache = 64

#sort_buffer_size = 512K

net_buffer_length = 8K

read_buffer_size = 256K

read_rnd_buffer_size = 512K

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

log-bin=mysqlSR3-bin

log-bin-index=mysql-bin

expire-logs-days=10

binlog-cache-size=102400000

max-binlog-size=204800000

max-binlog-size=1024000

# 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

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=<host>, MASTER_PORT=<port>,

# MASTER_USER=<user>, MASTER_PASSWORD=<password> ;

#

# where you replace <host>, <user>, <password> by quoted strings and

# <port> 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 = <hostname>

#

# The username the slave will use for authentication when connecting

# to the master - required

#master-user = <username>

#

# The password the slave will authenticate with when connecting to

# the master - required

#master-password = <password>

#

# The port the master is listening on.

# optional - defaults to 3306

#master-port = <port>

#

# binary logging - not required for slaves, but recommended

#log-bin=mysql-bin

# Uncomment the following if you are using InnoDB tables

#innodb_data_home_dir = /mysqldata

#innodb_data_file_path = ibdata1:10M:autoextend

#innodb_log_group_home_dir = /mysqldata

# You can set .._buffer_pool_size up to 50 - 80 %

# of RAM but beware of setting memory usage too high

#innodb_buffer_pool_size = 16M

#innodb_additional_mem_pool_size = 2M

# Set .._log_file_size to 25 % of buffer pool size

#innodb_log_file_size = 5M

#innodb_log_buffer_size = 8M

#innodb_flush_log_at_trx_commit = 1

#innodb_lock_wait_timeout = 50

[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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: