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 配置建议的更多相关文章

  1. mysql my.cnf 配置详解

    #配置多实例声明[mysqld_multi]mysqld = /data/mysql_bin/bin/mysqld_safemysqladmin = /data/mysql_bin/bin/mysql ...

  2. MYSQL服务器my.cnf配置文档详解

    MYSQL服务器my.cnf配置文档详解 硬件:内存16G [client] port = 3306 socket = /data/3306/mysql.sock [mysql] no-auto-re ...

  3. Mariadb/MySQL生产环境的my.cnf配置示例

    Mariadb/MySQL生产环境的my.cnf配置示例 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.针对MySQL主程序mysqld定义参数[mysqld]  1>. ...

  4. MYSQL多实例配置方法 mysqld_multi方法

    在实际的开发过程中,可能会需要在一台服务器上部署多个MYSQL实例,那建议使用MYSQL官方的解决方案 mysqld_multi 1.修改my.cnf 如一个定义两个实例的参考配置: [mysqld_ ...

  5. [转]MySQL5.5 my.cnf配置参考

    主要配置参数转载自: http://www.linuxyw.com/a/shujuku/20130506/216.html 并稍微做了修改MyISAM部分以适应当前的环境 此配置是老男孩生产线上使用的 ...

  6. MYSQL多实例配置与使用教程

    原文http://www.111cn.net/database/mysql/58651.htm 在实际的开发过程中,可能会需要在一台服务器上部署多个MYSQL实例,那建议使用MYSQL官方的解决方案 ...

  7. Virtual Box虚拟机Ubuntu18.X系统安装及Mysql基本开发配置

    Linux简介 什么是 Linux? Linux:世界上不仅只有一个 Windows 操作系统,还有 Linux.mac.Unix 等操作系统.桌面操作系统下 Windows 是霸主,而 Linux ...

  8. MySQL关于日志配置安全整改及处理方法

    [环境介绍] 系统环境:Linux + mysql 5.7.18 + 主从复制架构 [背景描述] 需求:MySQL数据库都有每年的集团安全整改,常常要求弱口令扫描,基线扫描,漏洞扫描等等.对于MySQ ...

  9. my.cnf配置优化

    MYSQL服务器my.cnf配置文档详解硬件:内存16G[client] port = 3306 socket = /data/3306/mysql.sock [mysql] no-auto-reha ...

随机推荐

  1. Oracle学习笔记(6)——函数

    函数的作用 方便数据的统计 处理查询结果 函数的分类 Oracle内置的系统函数 数值函数 四舍五入                                             ROUND ...

  2. redis清除数据/xargs使用

    redis清除数据/xargs使用 redis比memcache好的地方之一,如果memcache,恐怕就得关掉重启了. 1 使用cli FLUSHDB 清除一个数据库,FLUSHALL清除整个red ...

  3. (转)【风宇冲】Unity3D教程宝典之Blur

    原创文章如需转载请注明:转载自风宇冲Unity3D教程学院                   BlurBlur模糊其实理解了以后非常简单.核心原理就是 1个点的颜色 并不用该点的颜色,而是用该点周围 ...

  4. javascript扩展时间方法,格式化,加减日期

    /** *对Date的扩展,将 Date 转化为指定格式的String *月(M).日(d).小时(h).分(m).秒(s).季度(q) 可以用 1-2 个占位符, *年(y)可以用 1-4 个占位符 ...

  5. OpenGL ES 3.0顶点着色器(二)

    #version es uniform mat4 u_mvpMatrix; in vec4 a_position; in vec4 a_color;out vec4 v_color;void main ...

  6. iOS 获取已安装 的APP

    -(void)getAppPlist { Class LSApplicationWorkspace_class = objc_getClass("LSApplicationWorkspace ...

  7. 使用Jmeter对API进行性能测试

    先补充刚才测试的部分截图余下,后续详细补充内容. API Test.jmx 如下: <?xml version="1.0" encoding="UTF-8" ...

  8. 【树莓派】RPi desktop系统重启或关机挂起几个问题:plymouth-reboot.service、plymouth-poweroff.service、Deconfiguring network interfaces

    在基于intel平台安装的RPi desktop关机或者重启时,会存在挂起的问题,一直卡着不动. 挂起问题有3个: 系统关机时候,停留在:plymouth-poweroff.service 系统重启时 ...

  9. JXL基本操作

    一.jxl.jar概述 通过java操作excel表格的工具类库 支持Excel 95-2000的所有版本 生成Excel 2000标准格式 支持字体.数字.日期操作 能够修饰单元格属性 支持图像和图 ...

  10. Linux中进程与线程及CPU使用率查询

    一.进程查询: ps -e -o 'pid,comm,args,pcpu,rsz,vsz,stime,user,uid' 说明:PCPU是Cpu使用率,8核最多是800. 或者 ps -aux 二.线 ...