CentOSMySQL Server installation and configuration

Source: Internet
Author: User
Tags server installation and configuration
CentOSMySQL Server installation and configuration install Mysql program, there are generally three installation methods: 1. Direct Network installation; 2. Download the rpm package and upload it to the server for installation; 3. Use

CentOS MySQL Server installation and configuration install Mysql program, there are generally three installation methods: 1. Direct Network installation; 2. Download the rpm package and upload it to the server for installation; 3. Install the MySQL program through

CentOS MySQL Server installation and configuration

There are three installation methods for installing the Mysql program:
1. Direct Network installation;
2. Download the rpm package and upload it to the server for installation;
3. Compile and install the SDK using the original code;
Yum-y install mysql
Yum-y install mysql-server
Rpm-qa | grep mysql
------------------------------
Start/stop/restart/status
Service mysqld start
Service mysqld stop
Service mysqld restart
Service mysqld status
Pstree | grep mysqld // verify whether the service is started, which is rarely used;
The following message is displayed at the first startup:
Initialize the MySQL database: Installing MySQL system tables...
OK
Filling help tables...
OK
......
......
......
Note: ignore the many prompts, as long as you confirm that the final process is correct and started properly;

------------------------------
Mysql efficiency tuning:
1. Database directory
/Var/lib/mysql/

2. Configuration File
/Usr/share/mysql (mysql. server command and configuration file)

3. Related commands
/Usr/bin (commands such as mysqladmin mysqldump)

4. Start the script
/Etc/rc. d/init. d/(directory for starting the script file mysql)
5. Main configuration file/etc/my. cnf
Edit/etc/my. cnf
Skip-locking // avoid MySQL external locks, reduce the chance of errors and enhance stability;
Skip-name-resolve // forbid MySQL to perform DNS resolution on external connections and use IP addresses to authorize connections;
Back_log = 384 // control the number of possible MySQL connections;
Key_buffer_size = 256 M // specify the size of the buffer for the index. A server with 4 GB can be set to 384 M or M;
Sort_buffer_size = 6 M // the buffer size that can be used to query the sorting; it is recommended that the size of the 4 GB server be set to 6-8 M;
Read_buffer_size = 4 M // the buffer size that can be used by the read query operation;
Join_buffer_size = 8 M // the buffer size that can be used by the Joint query operation;
Myisam_sort_buffer_size = 64 M
Table_cache = 512
Thread_cache_size = 64
Query_cache_size = 64 M
Specify the size of the MySQL Query Buffer in CentOS. You can run the following command on the MySQL console:
> Show variables like '% query_cache % ';
> Show status like 'qcache % ';
If the Qcache_lowmem_prunes value is very large, it indicates that there is often insufficient buffer;
If the Qcache_hits value is very large, it indicates that the query buffer is used very frequently. If the value is small, it will affect the efficiency, you can consider not to use the Query Buffer; Qcache_free_blocks, if the value is very large, it indicates that there are many fragments in the buffer.
Mp_table_size = 256 M
Max_connections = 768
Specifies the maximum number of connection processes allowed by MySQL. If the Too connector Connections error message appears frequently during Forum access, you need to increase the value of this parameter.

Max_connect_errorrs = 10000000
Wait_timeout = 10
Specify the maximum connection time of a request. For servers with around 4 GB of memory, you can set it to 5-10.

Thread_concurrency = 8
In this example, the server has two physical CPUs, and each physical CPU supports H.T hyper-threading, therefore, the actual value is 4x2 = 8.
Skip-networking
Enabling this option can completely disable the MySQL TCP/IP connection mode. If the CentOS WEB Server accesses the MySQL database server remotely, do not enable this option! Otherwise, the connection will fail!

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.