Simple to solve the problem of MySQL resource too large

Source: Internet
Author: User
Tags log memory usage mysql resource sleep socket variable linux

In Linux, often the case is the use of VBB this forum system, the emergence of slow, MySQL suspended animation state, the sleep process is too much and so is like. Led to dozens of users, the system is done.
In fact, this is a MySQL configuration problem, the default Linux, MySQL configuration is my-large.cnf configuration, the configuration for large servers. There is high memory, such as 2g,4g memory, suitable for use, and the general 512M memory is not. It consumes 512M of memory to save the process of system MySQL, which is long stacked and not released, causing the system to slow down. So, change the configuration to become my-small.cnf, small configuration is OK. It is configured as follows:
# Example MySQL config file for small systems.
#
# This is for a system with little memory (<= 64M) where the MySQL is only used
# from time to time and it ' s important the mysqld Deamon
# doesn ' t use much of the resources.
#
# You can copy this file to
#/ETC/MY.CNF to set global options,
# MYSQL-DATA-DIR/MY.CNF to set server-specific options
# installation This directory is/var/lib/mysql) or
# ~/.MY.CNF to set user-specific options.
#
# One can in this file with all long options supports.
# If you are want to know which options a program support, run the program
# with--HELP option.
# The following options would be passed to all MySQL clients
[Client]
#password = Your password
Port = 3306
Socket =/tmp/mysql.sock
# here follows entries for some specific programs
# The MySQL server
[Mysqld]
Port = 3306
Socket =/tmp/mysql.sock
Skip-locking
Set-variable = key_buffer=16k
Set-variable = max_allowed_packet=1m
Set-variable = thread_stack=64k
Set-variable = table_cache=4
Set-variable = sort_buffer=64k
Set-variable = net_buffer_length=2k
Server-id = 1
# Uncomment the following if you are want to log updates
#log-bin
# Uncomment the following if you are is not using BDB tables
#skip-BDB
# Uncomment the following if you are using InnoDB tables
#innodb_data_home_dir =/var/lib/mysql/
#innodb_data_file_path = Ibdata1:10m:autoextend
#innodb_log_group_home_dir =/var/lib/mysql/
#innodb_log_arch_dir =/var/lib/mysql/
# you can set ... _buffer_pool_size up to 50-80%
# of RAM But beware of setting memory usage too high
#set-variable = innodb_buffer_pool_size=16m
#set-variable = innodb_additional_mem_pool_size=2m
# Set ... _log_file_size to% of buffer pool size
#set-variable = innodb_log_file_size=5m
#set-variable = innodb_log_buffer_size=8m
#innodb_flush_log_at_trx_commit =1
#set-variable = innodb_lock_wait_timeout=50
[Mysqldump]
Quick
Set-variable = max_allowed_packet=16m
[MySQL]
No-auto-rehash
# Remove The next comment character if you are not familiar with SQL
#safe-updates
[Isamchk]
Set-variable = key_buffer=8m
Set-variable = sort_buffer=8m
[Myisamchk]
Set-variable = key_buffer=8m
Set-variable = sort_buffer=8m
[Mysqlhotcopy]
Interactive-timeout
The above configuration is enough for your system to run MySQL at high speed, the sleep process is quickly recycled and does not account for resources, which is ideal for small servers. The typical personal hosting server is also appropriate.




Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.