Chinaunix首页 | 论坛 | 博客
  • 博客访问: 154912
  • 博文数量: 24
  • 博客积分: 528
  • 博客等级: 中士
  • 技术积分: 288
  • 用 户 组: 普通用户
  • 注册时间: 2011-09-10 10:33
文章分类

全部博文(24)

文章存档

2012年(6)

2011年(18)

分类: Mysql/postgreSQL

2011-11-07 17:41:09

#
# The MySQL database server configuration file.
#
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html

# This will be passed to all mysql clients
# It has been reported that passwords should be enclosed with ticks/quotes
# escpecially if they contain "#" chars...
# Remember to edit /etc/mysql/debian.cnf when changing the socket location.
[client]    $$$:以下选项会被MySQL客户端应用读取.
port        = 3306
socket        = /var/run/mysqld/mysqld.sock    $$$:用于本地连接的Unix套接字文件。

# Here is entries for some specific programs
# The following values assume you have at least 32M ram

# This was formally known as [safe_mysqld]. Both versions are currently parsed.
[mysqld_safe]
socket        = /var/run/mysqld/mysqld.sock    $$$:用于本地连接的Unix套接字文件。
nice        = 0    $$$:使用nice程序根据给定值来设置服务器的调度优先级。

[mysqld]    $$$:MySQL 办事端
#
# * Basic Settings
#

#
# * IMPORTANT
#   If you make changes to these settings and your system uses apparmor, you may
#   also need to also adjust /etc/apparmor.d/usr.sbin.mysqld.
#

user        = mysql
socket        = /var/run/mysqld/mysqld.sock    $$$:为MySQL客户程序与服务器之间的本地通信指定一个套接字文件
port        = 3306    $$$:指定MsSQL侦听的端口
basedir        = /usr    $$$:使用该目录作为根目录(安装目录)。
datadir        = /var/lib/mysql   $$$:从该目录读取数据库文件。
tmpdir        = /tmp
skip-external-locking
skip-name-resolve    $$$:禁止MySQL对外部连接进行DNS解析,使用这一选项可以消除MySQL进行DNS解析的时间。但需要注意,如果开启该选项,则所有远程主机连接授权都要使用IP地址方式,否则MySQL将无法正常处理连接请求!
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
#bind-address        = 127.0.0.1
#
# * Fine Tuning
#
key_buffer        = 16M    $$$:key_buffer是用于索引块的缓冲区大小,增加它可得到更好处理的索引(对所有读和多重写)。对于内存在4GB左右的服务器该参数可设置为256M或384M。注意:该参数值设置的过大反而会是服务器整体效率降低!
max_allowed_packet    = 16M    $$$:包或任何生成的/中间字符串的最大大小。
thread_stack        = 192K
thread_cache_size       = 8    $$$:缓存可重用的线程数
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover         = BACKUP    $$$:存储引擎MyISAM设置为恢复模式。该选项值是DEFAULT、BACKUP、FORCE或QUICK值的任何组合.
#max_connections        = 100    $$$:MySQL服务器同时处理的数据库连接的最大数量(默认设置是100)。超过限制后会报 Too many connections 错误
#table_cache            = 64    $$$:为所有线程打开表的数量。增加该值能增加mysqld要求的文件描述符的数量。可以避免频繁的打开数据表产生的开销
#thread_concurrency     = 10    $$$:最大并发线程数,取值为服务器逻辑CPU数量×2,如果CPU支持H.T超线程,再×2
#
# * Query Cache Configuration
#
query_cache_limit    = 10M    $$$:只有小于此设定值的结果才会被缓冲,此设置用来保护查询缓冲,防止一个极大的结果集将其他所有的查询结果都覆盖.
query_cache_size        = 160M    $$$:指定MySQL查询结果缓冲区的大小
open_files_limit    = 2048    $$$:用来更改mysqld文件描述符的数量。
#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# As of 5.1 you can enable the log at runtime!
#general_log_file        = /var/log/mysql/mysql.log
#general_log             = 1

log_error                = /var/log/mysql/error.log    $$$:将错误日志写入给定的文件

# Here you can see queries with especially long duration
#log_slow_queries    = /var/log/mysql/mysql-slow.log
#long_query_time = 2
#log-queries-not-using-indexes
#
# The following can be used as easy to replay backup logs or for replication.
# note: if you are setting up a replication slave, see README.Debian about
#       other settings you may need to change.
#server-id        = 1
#log_bin            = /var/log/mysql/mysql-bin.log
expire_logs_days    = 10    $$$:二进制日志自动删除的天数。默认值为0,表示“没有自动删除”。启动时和二进制日志循环时可能删除。
max_binlog_size         = 100M    $$$:如果二进制日志写入的内容超出给定值,日志就会发生滚动。你不能将该变量设置为大于1GB或小于4096字节。 默认值是1GB。
#binlog_do_db        = include_database_name
#binlog_ignore_db    = include_database_name
#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
#
# * Security Features
#
# Read the manual, too, if you want chroot!
# chroot = /var/lib/mysql/
#
# For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
#
# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem



[mysqldump]    $$$:转存储数据库的实用程序
quick
quote-names
max_allowed_packet    = 16M    $$$:服务器和客户端之间最大能发送的可能信息包

[mysql]
#no-auto-rehash    # faster start of mysql but no tab completition

[isamchk]    $$$:完成表的分析和优化,以及在表损坏时进行崩溃恢复的程序。
key_buffer        = 16M

#
# * IMPORTANT: Additional settings that can override those from this file!
#   The files must end with '.cnf', otherwise they'll be ignored.
#
!includedir /etc/mysql/conf.d/
阅读(5847) | 评论(0) | 转发(0) |
0

上一篇:emacs基本命令

下一篇:mysql语句技巧

给主人留下些什么吧!~~