Tối ưu dịch vụ MySQL cho VPS 1G RAM


Việc tối ưu dịch vụ MySQL rất quan trọng, cải thiện đáng kể tốc độ load trang và truy xuất dữ liệu. Trong bài viết này chúng tôi sẽ hướng dẫn tối ưu dịch vụ MySQL cho VPS linux 1G ram.

#vi /etc/my.cnf

Nhập nội dung sau:

[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

#service mysqld restart




0 Nhận xét:

Đăng nhận xét