Mysql5

確定要調整的正確 my.cnf 文件

  • December 18, 2011

在 Centos VPS 中,我想調整 Mysql Server:

find -name *my*cfn
./usr/share/doc/mysql-server-5.0.77/my-huge.cnf
./usr/share/doc/mysql-server-5.0.77/my-innodb-heavy-4G.cnf
./usr/share/doc/mysql-server-5.0.77/my-small.cnf
./usr/share/doc/mysql-server-5.0.77/my-medium.cnf
./usr/share/doc/mysql-server-5.0.77/my-large.cnf
./usr/share/mysql/my-huge.cnf
./usr/share/mysql/my-innodb-heavy-4G.cnf
./usr/share/mysql/my-small.cnf
./usr/share/mysql/my-medium.cnf
./usr/share/mysql/my-large.cnf
./etc/my.cnf

/etc/my.cfn 的內容是:

# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1

# Disabling symbolic-links is recommended to prevent assorted security risks;
# to do so, uncomment this line:
# symbolic-links=0

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

它太小了,不是嗎?我必須在這裡輸入參數 key_buffer_size innodb_additional_mem_pool_size innodb_log_file_size 等的值嗎?

嗯,它是沒有任何設置的配置文件。沒問題。您可以創建[mysqld]部分並調整其中的任何內容,也可以將範例文件之一 ( ./usr/share/mysql/*) 複製到/etc/my.cnf並調整它。

要檢查是否/etc/my.cnf正在使用,請執行mysqld --help --verbose | head -n 20並查找以下行:

Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf ~/.my.cnf

引用自:https://serverfault.com/questions/342065