Edit /etc/my.cnf or /etc/mysql/my.cnf and add the following lines to the [mysqld] section:

set-variable = expire_logs_days=7
set-variable = max_connections=11000
set-variable = max_user_connections=10000
set-variable = query-cache-size=256M
set-variable = wait_timeout=172800

Add this line to the [mysqld_safe] section:

open-files-limit = 65535