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 ...
随机推荐
- variable_scope和name_scope差别
先看代码: #命名空间函数tf.variable_scope()和tf.name_scope()函数区别于使用 import tensorflow as tf with t ...
- Centos配置为驱动程序开发环境
安装完centos后,写了一个驱动测试程序Hello.编译过程出现如下错误: make: *** /lib/modules/2.6.32-220.4.1.el6.i686/build: No such ...
- 闲聊DNN CTR预估模型
原文:http://www.52cs.org/?p=1046 闲聊DNN CTR预估模型 Written by b manongb 作者:Kintocai, 北京大学硕士, 现就职于腾讯. 伦敦大学张 ...
- 前端框架 Vue 初探
一.前言 前几日使用微信网页版时,好奇这个网页用了什么前端框架.用Chrome的开发人员模式一探到底,发现原来用了一个名叫 Angular 的框架.好吧,既然微信用了.那我也最好还是看看.等等,你这篇 ...
- Using Timers in MFC Applications
Timer Events in MFC Applications Event timers are always handy to have around and useful in nearly e ...
- Red Hat Enterprise Linux AS release 4 yum源
$sudo vim /etc/yum.conf [main] cachedir=/var/cache/yum debuglevel=2 logfile=/var/log/yum.log pkgpoli ...
- DELL平板如何安装WIN10系统 -标记活动分区的问题
在计算机管理中没有这个选项 可以在分区助手软件中,选中C分区之后,左边有设置活动分区,然后左上角提交执行即可
- linux:C++的socket编程
基本的局域网聊天 局域网聊天TCP服务端: #include <sys/types.h> #include <sys/socket.h> #include <stdio. ...
- ng-class ng-style
https://docs.angularjs.org/api/ng/directive/ngClass 翻译 表达式生成一个空格饭分隔的class字符串 一个对象,它的每一个key在其值为true的时 ...
- Git之第三方托管oschina
一.git 简介 1.Git是一款免费.开源的分布式版本控制系统,用于敏捷高效地处理任何或小或大的项目. 2.Git是一个开源的分布式版本控制系统,用以有效.高速的处理从很小到非常大的项目版本管理. ...