How to optimize MySql for 1GB Memory VPS

[mysqld]
max_connections=250
max_user_connections = 30
key_buffer_size = 4M
myisam_sort_buffer_size = 16M
join_buffer_size = 8M
read_buffer_size = 8M
sort_buffer_size = 8M
record_buffer_size = 8M
max_allowed_packet = 300M
table_open_cache = 200
thread_cache_size = 128
wait_timeout = 15
connect_timeout = 20
interactive_timeout = 25
max_connect_errors = 20
query_cache_type = 1
query_cache_limit = 32
query_cache_size = 32M
log-slow-queries

[mysqld_safe]
open_files_limit = 8192

[mysqldump]
max_allowed_packet = 8M

[myisamchk]
key_buffer_size = 32M
sort_buffer_size = 16M
read_buffer_size = 20M
write_buffer_size = 20M
local-infile=0

https://forums.cpanel.net/threads/etc-my-cnf-optimization.237351/

outro exemplo:


[mysqld]
max_connections = 400
key_buffer = 32M
myisam_sort_buffer_size = 32M
join_buffer_size = 1M
read_buffer_size = 1M
sort_buffer_size = 2M
table_cache = 1024
thread_cache_size = 286
interactive_timeout = 25
wait_timeout = 1000
connect_timeout = 10
max_allowed_packet = 16M
max_connect_errors = 10
query_cache_limit = 1M
query_cache_size = 16M
query_cache_type = 1
tmp_table_size = 16M


[mysqld_safe]
open_files_limit = 8192

[mysqldump]
quick
max_allowed_packet = 16M

[myisamchk]
key_buffer = 64M
sort_buffer = 64M
read_buffer = 16M
write_buffer = 16M

local-infile=0

save.

Restart mysql

/etc/rc.d/init.d/mysql restart

Restore old backup
cp /etc/my.cnf.old /etc/my.cnf

/etc/rc.d/init.d/mysql restart

 

http://www.maxwhale.com/how-to-optimize-mysql-for-1gb-memory-vps/

Deixe um comentário