MySQL optimization all Raiders-server parameter adjustment _php Tutorial

Source: Internet
Author: User
The correct method of compiling is important, but it is only part of the effort to improve the performance of the MySQL server. Many of the parameters of the MySQL server affect the performance of the server, and we can save these parameters to the configuration file, so that each time the MySQL server starts, these parameters are automatically functioning. This configuration file is my.cnf.
 
MySQL server provides several examples of my.cnf files, which can be found under the/usr/local/mysql/share/mysql/directory, with names my-small.cnf, MY-MEDIUM.CNF, My-large.cnf and MY-HUGE.CNF. A description of the size in the file name describes the system type that the profile applies to. For example, if you run a MySQL server with little system memory and MySQL is only occasionally used, then using the MY-SMALL.CNF configuration file is ideal, and this profile tells Mysqld Daemon to use minimal system resources. Conversely, if the MySQL server is used to support a large-scale online store, the system has 2G of memory, then the use of MYSQL-HUGE.CNF is the most appropriate.
 
To use the example configuration file above, we should first copy a configuration file that is best suited to the requirement and name it my.cnf. This copy of the configuration file can be used in the following three ways:
Global: Copy this my.cnf file to the server's/etc directory, where the parameters defined in the file are globally valid, which is valid for all MySQL database servers running on that server.
 
Local: Copying this my.cnf file to [mysql-install-dir]/var/] will make the file valid only for the specified server, where [Mysql-install-dir] represents the directory where MYSQL is installed.
 
User: Finally, we can also limit the scope of the file to the specified user, which simply copies the my.cnf file to the user's root directory.
 
So, how do I set the parameters in the my.cnf file? Or further, what are the parameters that we can set? All of these parameters have a global impact on the MySQL server, but at the same time each parameter is closely related to the specific part of MySQL. For example, the max_connections parameter belongs to the Mysqld class. So how do you know that? This simply executes the following command:
% >/usr/local/mysql/libexec/mysqld--help

The command displays various options and parameters related to mysqld. It is convenient to look for these parameters, since these parameters are behind the line "Possible Variables for option--set-variable (-O) is". Once these parameters are found, we can set all these parameters in the My.cnf file as follows:
Set-variable = max_connections=100

The effect of this line of code is that the maximum number of connections to the MySQL server at the same time is limited to 100. Do not forget to add a set-variable directive in the my.cnf file [mysqld] section, see the example in the configuration file

http://www.bkjia.com/PHPjc/631192.html www.bkjia.com true http://www.bkjia.com/PHPjc/631192.html techarticle the correct method of compiling is important, but it is only part of the effort to improve the performance of the MySQL server. Many parameters of the MySQL server can affect the performance of the server, and we can take this ...

  • 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.