手动安装MySQL时,需要配置一些参数,以满足自己的需求。配置文件位于MySQL安装目录下的“my.cnf”(或my.ini,Windows系统下)。以下是一个基本的配置文件示例:
[client]
port=3306
socket=/tmp/mysql.sock
[mysqld]
port=3306
socket=/tmp/mysql.sock
skip-external-locking
key_buffer_size=16M
max_allowed_packet=8M
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
thread_cache_size=8
query_cache_size=16M
# Uncomment the following if you are using InnoDB tables
# innodb_data_home_dir = /usr/local/mysql/data
# innodb_data_file_path = ibdata1:10M:autoextend
# innodb_log_group_home_dir = /usr/local/mysql/data
# innodb_log_arch_dir = /usr/local/mysql/data
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
# innodb_buffer_pool_size = 256M
# innodb_additional_mem_pool_size = 20M
# Set .._log_file_size to 25 % of buffer pool size
# innodb_log_file_size = 64M
# 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
[myisamchk]
key_buffer_size=20M
sort_buffer_size=20M
read_buffer_size=2M
write_buffer_size=2M
[mysqlhotcopy]
interactive-timeout
需要注意的是,该配置文件仅供参考。你需要根据你的服务器性能、运行环境及需求来自定义配置