I was wondering if these my.cnf values would be ok for a Xeon 2.33GHz VPS with 1GB of RAM. There are ~5 sites on the server with low traffic and the server is running Apache/PHP/MySQL... Also I want to enable the MySQL query cache and would appreciate any advise re the amount of RAM to allocate to the cache...
MySQL Settings:
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# 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 preven开发者_Go百科t assorted security risks;
# to do so, uncomment this line:
# symbolic-links=0
key_buffer = 16K
max_allowed_packet = 1M
thread_stack = 64K
table_cache = 4
sort_buffer = 64K
net_buffer_length = 2K
bind-address = 127.0.0.1
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
Thanks for the help :)
Some memory chache was set too small compare to 1GB RAM, even if you may use a virtual machine actually. Performance may be better if you change some options and that won't eat too much resources.
If you are not sue what to change, take a look at MySQL recommanded configuration. These files was located at /usr/share/doc/mysql-server-x.x/examples Your configuration may belongs to my-small.conf, my-medium.cnf is better suitable for you.
I recommend you use mytop to analyze real-time activity of your database.
Also used mysqltuner to give you suggestions on your my.cnf values.
Too enables logging of slow queries:
log_slow_queries = /var/log/mysql/mysql-slow.log
long_query_time = 3
The configuration of my dedicated server for a high rate of transactions if anything helps:
max_allowed_packet=16M
key_buffer_size=8M
innodb_additional_mem_pool_size=10M
innodb_buffer_pool_size=512M
join_buffer_size=40M
table_open_cache=1024
query_cache_size=40M
table_definition_cache=256
innodb_additional_mem_pool_size=10M
key_buffer_size=16M
max_allowed_packet=32M
max_connections = 300
query_cache_limit = 10M
log_slow_queries = /var/log/mysql/mysql-slow.log
long_query_time = 3
I hope it helps somewhat. If you want to refer details about these(and many other) server parameters, refer this Official MySQL Documentation
Regards.
精彩评论