mysql my.cnf 配置建议
mysql的配置文件是/etc/my.cnf,通过修改它来配置mysql。
/etc/my.cnf来自以下文件:
如果你的内存≤64M,则复制/usr/local/share/mysql/my-small.cnf为/etc/my.cnf
# This is for a system with little memory (<= 64M) where MySQL is only used
# from time to time and it’s important that the mysqld daemon
# doesn’t use much resources.
如果内存是128M,则复制/usr/local/share/mysql/my-medium.cnf为/etc/my.cnf
# This is for a system with little memory (32M – 64M) where MySQL plays
# an important part, or systems up to 128M where MySQL is used together with
# other programs (such as a web server)
如果内存是512M,则复制/usr/local/share/mysql/my-large.cnf为/etc/my.cnf
# This is for a large system with memory = 512M where the system runs mainly
# MySQL.
如果内存是1-2G,则复制/usr/local/share/mysql/my-huge.cnf为/etc/my.cnf
# This is for a large system with memory of 1G-2G where the system runs mainly
# MySQL.
如果内存是4G,则复制/usr/local/share/mysql/my-innodb-heavy-4G.cnf为/etc/my.cnf
# This is a MySQL example config file for systems with 4GB of memory
# running mostly MySQL using InnoDB only tables and performing complex
# queries with few connections.
不过MySQL参数那么多,很多时候我们还是要知道他们具体的含义才能根据实际问题做出具体的调整。
———————————–
我们可以通过SHOW VARIABLES;来查看系统参数,通过SHOW STATUS;来判断系统状态。
———————————–
先来看看table_cache参数对性能的影响。摘录my-innodb-heavy-4G.cnf中对它的描述:
# The number of open tables for all threads. Increasing this value
# increases the number of file descriptors that mysqld requires.
# Therefore you have to make sure to set the amount of open files
# allowed to at least 4096 in the variable “open-files-limit” in
# section [mysqld_safe]
table_cache = 2048
比如:当系统比较繁忙的时候,我们show variables;查到table_cache的值,再show
status;发现open_tables的值和table_cache差不多,而且opened_tables还一直再增加,就说明我们的
table_cache设置的太小了。
mysql my.cnf 配置建议的更多相关文章
- mysql my.cnf 配置详解
#配置多实例声明[mysqld_multi]mysqld = /data/mysql_bin/bin/mysqld_safemysqladmin = /data/mysql_bin/bin/mysql ...
- MYSQL服务器my.cnf配置文档详解
MYSQL服务器my.cnf配置文档详解 硬件:内存16G [client] port = 3306 socket = /data/3306/mysql.sock [mysql] no-auto-re ...
- Mariadb/MySQL生产环境的my.cnf配置示例
Mariadb/MySQL生产环境的my.cnf配置示例 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.针对MySQL主程序mysqld定义参数[mysqld] 1>. ...
- MYSQL多实例配置方法 mysqld_multi方法
在实际的开发过程中,可能会需要在一台服务器上部署多个MYSQL实例,那建议使用MYSQL官方的解决方案 mysqld_multi 1.修改my.cnf 如一个定义两个实例的参考配置: [mysqld_ ...
- [转]MySQL5.5 my.cnf配置参考
主要配置参数转载自: http://www.linuxyw.com/a/shujuku/20130506/216.html 并稍微做了修改MyISAM部分以适应当前的环境 此配置是老男孩生产线上使用的 ...
- MYSQL多实例配置与使用教程
原文http://www.111cn.net/database/mysql/58651.htm 在实际的开发过程中,可能会需要在一台服务器上部署多个MYSQL实例,那建议使用MYSQL官方的解决方案 ...
- Virtual Box虚拟机Ubuntu18.X系统安装及Mysql基本开发配置
Linux简介 什么是 Linux? Linux:世界上不仅只有一个 Windows 操作系统,还有 Linux.mac.Unix 等操作系统.桌面操作系统下 Windows 是霸主,而 Linux ...
- MySQL关于日志配置安全整改及处理方法
[环境介绍] 系统环境:Linux + mysql 5.7.18 + 主从复制架构 [背景描述] 需求:MySQL数据库都有每年的集团安全整改,常常要求弱口令扫描,基线扫描,漏洞扫描等等.对于MySQ ...
- my.cnf配置优化
MYSQL服务器my.cnf配置文档详解硬件:内存16G[client] port = 3306 socket = /data/3306/mysql.sock [mysql] no-auto-reha ...
随机推荐
- Android -- 获取View宽高
在activity中可以调用View.getWidth.View.getHeight().View.getMeasuredWidth() .View.getgetMeasuredHeight()来获得 ...
- [置顶] Hadoop2.2.0中HDFS的高可用性实现原理
在Hadoop2.0.0之前,NameNode(NN)在HDFS集群中存在单点故障(single point of failure),每一个集群中存在一个NameNode,如果NN所在的机器出现了故障 ...
- Java-Shiro(四):Shiro
https://blog.csdn.net/visket2008/article/details/78539334 不错的视屏教程,很实用:https://www.bilibili.com/video ...
- Horizon Is Easy, Horizon Is Complex
本文出自我的同事兼基友@monsterxx03 之手,本人稍作润色 Horizon Is Easy, Horizon Is Complex 如果要用一句话来概括Openstack Dashboard项 ...
- ArcMap中条件语句的bug
ArcGIS作为一个十分强大的GIS工具平台,也有其bug,在以前在听说过关于SQL条件语句的bug,现在用的10.4.1,仍然与数据有关. 这个bug的出现也是非常偶然,与数据有密切的关系:发现省界 ...
- Linux下GoAccess的安装与全部用法
GoAccess用户文档 一. GoAccess概述 1.1 GoAccess概述 goaccess是一个实时的web日志分析器,以及交互式查看器,在类Unix系统的终端(terminal)上运行 ...
- PYQT实现简单的浏览器功能
主要的类 QMainWindow 提供一个有菜单条.锚接窗口(例如工具条)和一个状态条的主应用程序窗口. http://www.kuqin.com/qtdocument/qmainwindow.htm ...
- time series review
https://pdfs.semanticscholar.org/fc9c/1a94a15dd44c8c61b3e4841ecb9505f8cd37.pdf https://edoc.hu-berli ...
- 《鸟哥的Linux私房菜》学习笔记0——计算机概论
一:CPU架构 精简指令集CPU:SPARC系列.PowerPC系列.ARM系列.其中,ARM CPU广泛应用于手机.PDA.导航系统等设备. 复杂指令集CPU:x86架构的CPU,大量用于个人电脑, ...
- psql 查询表大小
select schemaname,tablename,pg_relation_size(schemaname||'.'||tablename) as tabsize from pg_tables o ...