mysql配置参数设置和进程管理

# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html [mysqld]
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at % of total RAM for dedicated server, else %.
# innodb_buffer_pool_size = 128M
#
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# ns=
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
#datadir=/var/lib/mysql
datadir=/data/mysql/data
socket=/var/lib/mysql/mysql.sock
#skip-grant-tables //免身份认证,忘记密码的情况下重置密码很管用
default_password_lifetime= sql_mode = '' # Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links= #log-error=/var/log/mysqld.log
#pid-file=/var/run/mysqld/mysqld.pid log-error=/data/mysql/logs/mysqld.log //mysql系统日志,包括启动错误日志
pid-file=/data/mysql/mysqld.pid #server-id=2 //如果开启llog-bin,就需要设置server-id #master-host=119.28.44.164
#master-user=backup
#master-password=Syhuo.net2018
#master-port=
#master-connect-retry=
#replicate-do-db=zhihuo
#max_allowed_packet = 50M #log-bin=/data/mysql/logs/log-bin.log
#expire_logs_days =
#增加federated引擎的支持
federated #开启慢查询日志
#slow-query-log-file="/data/mysql/slowlog/slowlog.log"
#slow_query_log=
#long_query_time=
#log-queries-not-using-indexes
#max_connections=20000 //优化参数,mysql sleep进程, too many connections abort connections 可以通过show processlist查看mysql进程,kill id暴力断开连接,
max_allowed_packet=10M
wait_timeout=
interactive_timeout=28800 [root@izbp18dv3a3metugyd02qxz run]# free
              total        used        free      shared  buff/cache   available
Mem:       15732560     2032016     4969812       15732     8730732    13348568
Swap:             0           0           0
说明:配置足够高,可以
max_allowed_packet=10M
wait_timeout=28800
interactive_timeout=28800
设置,也不会adbort connections ,lost connection ,错误可以log-error=/data/mysql/logs/mysqld.log tail -f 监控到 减少sleep进程措施

1. 程序中,不使用持久链接,即使用mysql_connect而不是pconnect。

2.   程序执行完毕,应该显式调用mysql_close

3. 只能逐步分析系统的SQL查询,找到查询过慢的SQL,优化之



上一篇:在ASP.NET MVC3项目中,自定义404错误页面


下一篇:【手把手教你Elmah】如何在MVC.NET项目中在线查看【错误日志】