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. 学界 | Yann LeCun新作,中日韩文本分类到底要用哪种编码?

    https://www.wxwenku.com/d/102093756 AI科技评论按:前几天,Yann LeCun与其学生 张翔在arXiv上发表了一篇新作「Which Encoding is th ...

  2. Spring(十五):通过注解配置 Bean

    在ClassPath中扫描组件 1)组件扫描(component scanning):Spring能够从classpath下自动扫描,侦测和实例化具有特定注解的组件: 2)特定组件包含: --- @C ...

  3. eclipse help说明链接

    http://help.eclipse.org/luna/index.jsp?topic=%2Forg.eclipse.cdt.doc.user%2Freference%2Fcdt_u_prop_bu ...

  4. SliTaz 从入门到精通

    slitaz中文化(linux-pe)项目地址: https://code.google.com/p/linux-pe/ http://bbs.wuyou.com/forum.php?mod=view ...

  5. 面试总结——Java高级工程师(三)

    https://blog.csdn.net/moneyshi/article/details/53086927

  6. jQuery动画animate方法使用介绍

    用于创建自定义动画的函数. 返回值:jQuery animate(params, [duration], [easing], [callback]) 如果使用的是“hide”.“show”或“togg ...

  7. 升级华为s2016

    Part 1 升级Bootrom 概述:启动启动菜单,用xmodem协议升级BootRom 升级的文件如下: wnm2.2.3-0004.zip :web网管zip压缩包文件. S2008_16-VR ...

  8. LCD显示——点阵字体

    Bitmap font 点阵字体是把每一个字符都分成16×16或24×24个点,然后用每个点的虚实来表示字符的轮廓. 点阵字体优点是显示速度快,不像矢量字体需要计算:其最大的缺点是不能放大,一旦放大后 ...

  9. 算法笔记_224:夺冠概率模拟(Java)

    目录 1 问题描述 2 解决方案   1 问题描述 足球比赛具有一定程度的偶然性,弱队也有战胜强队的可能. 假设有甲.乙.丙.丁四个球队.根据他们过去比赛的成绩,得出每个队与另一个队对阵时取胜的概率表 ...

  10. GoldenGate 12c 新特性 Credential Store and USERIDALIAS

    GoldenGate 12C的Credential Store and USERIDALIAS新特性有点类似存储钱夹,提高了配置的易用性和安全性. --生成credentialstore文件 GGSC ...