Install Percona Server+MySQL on CentOS 7

Install Percona Server+MySQL on CentOS 7

1. Environmental Description

(1) CentOS-7-x86_64, kernel version

uname -r
3.10.0-693.el7.x86_64

(2) MySQL version

percona-server-5.6.29

(3) File storage path

/home/soft

2. Preparation before installation

(1) Configure permissions

groupadd mysql
useradd -r -g mysql mysql

(2) Create an installation directory

mkdir /usr/local/mysql #mysql installation directory chown -R mysql:mysql /usr/local/mysql

mkdir /usr/local/mysql/dataconf #Database configuration storage directory chown -R mysql:mysql /usr/local/mysql/dataconf

mkdir /usr/local/mysql/sock #The directory where mysql.sock is stored when running mysql.chown -R mysql:mysql /usr/local/mysql/sock 

 mkdir /var/log/mysql #Create a log storage directory touch /var/log/mysql/mysql.log
chown -R mysql:mysql /var/log/mysql/mysql.log
  
touch /usr/local/mysql/my.cnf #Create mysql configuration file

3. Install the compilation environment

yum install readline-devel git gcc gcc-c++ make cmake bison bison-devel ncurses-devel libaio-devel perl zlib1g-dev autoconf

4. Compile and install percona

cd /home/soft/
tar zxvf percona-server-5.6.29-76.2.tar.gz 
cd percona-server-5.6.29-76.2

cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql #CMake is needed for installation. Here is the file installation directory -DSYSCONFDIR=/usr/local/mysql #Directory for storing configuration files -DMYSQL_DATADIR=/usr/local/mysql/dataconf #Directory for storing databases -DMYSQL_UNIX_ADDR=/usr/local/mysql/sock/mysqld.sock #Directory for storing mysql.sock files -DMYSQL_TCP_PORT=3306 -DWITH_MYISAM_STORAGE_ENGINE=1 #Configure port -DWITH_INNOBASE_STORAGE_ENGINE=1 
-DWITH_PARTITION_STORAGE_ENGINE=1 
-DEXTRA_CHARSETS=all 
-DDEFAULT_CHARSET=utf8 #Configure the default character encoding format -DDEFAULT_COLLATION=utf8_general_ci 
-DENABLED_LOCAL_INFILE=1 
-DWITH_EDITLINE=bundled 
-DCMAKE_BUILD_TYPE=RelWithDebInfo 
-DBUILD_CONFIG=mysql_release 
-DFEATURE_SET=community 
-DWITH_EMBEDDED_SERVER=OFF

After that, continue compiling and installing.

make -j 8 #It will take about 30-40 minutes. If an error occurs, use make clean , rm -rf CMakeCache.txt
make install

5. Configure Percona parameters

cat /usr/local/mysql/my.cnf

[mysqld]
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
explicit_defaults_for_timestamp=true   
federated
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd
basedir=/usr/local/mysql
datadir=/usr/local/mysql/dataconf
port=3306
socket=/usr/local/mysql/sock/mysql.sock
symbolic-links=0
character_set_server=utf8
pid-file=/usr/local/mysql/mysql.pid
skip-grant-tables


[mysqld_safe]
log-error=/var/log/mysql/mysql.log
pid-file=/usr/local/mysql/mysql.pid
socket=/usr/local/mysql/sock/mysql.sock


[client] 
socket=/usr/local/mysql/mysql.sock 

[mysql.server] 
user=mysql 
basedir=/usr/local/mysql 
socket=/usr/local/mysql/sock/mysql.sock

[mysql]
socket=/usr/local/mysql/sock/mysql.sock

6. Configure Mysql access permissions

chown -R mysql:mysql /usr/local/mysql/bin
chown -R mysql:mysql /usr/local/mysql/mysql.pid

7. Initialize the Mysql server

/usr/local/mysql/scripts/mysql_install_db --defaults-file=/usr/local/mysql/my.cnf --basedir=/usr/local/mysql --datadir=/usr/local/mysql/dataconf --user=mysql

8. Configure environment variables

In order to call the mysql command directly, you need to configure the environment variable vi /etc/profile
Add export PATH=/usr/local/mysql/bin:$PATH to the end of the /etc/profile file
Make the environment variables take effect immediately source /etc/profile

9. Configure startup script

cp /home/soft/percona-server-5.6.29-76.2/support-files/mysql.server /etc/init.d/mysql
chmod +x /etc/init.d/mysql
chkconfig mysql on
service mysql start/stop

10. Postscript

I don't know why this method can be used after installation in CentOS7, but cannot be compiled, installed and used in Debian server. In addition, during use, Percona-Server-client support may sometimes be required. To solve this problem, you can use the following method: upload the file to the /home/soft/ directory and then install it. The installation method is as follows:

rpm -ivh Percona-Server-shared-compat-5.5.35-rel33.0.611.rhel6.x86_64.rpm
rpm -ivh Percona-Server-shared-55-5.5.35-rel33.0.611.rhel6.x86_64.rpm
rpm -ivh Percona-Server-devel-55-5.5.35-rel33.0.611.rhel6.x86_64.rpm
rpm -ivh Percona-Server-client-55-5.5.35-rel33.0.611.rhel6.x86_64.rpm

Or use rpm -ivh * to install

You may also be interested in:
  • CentOS 6.4 installation and configuration of LAMP server (Apache+PHP5+MySQL)
  • CentOS+Nginx+PHP+MySQL detailed configuration (illustration)
  • Steps to install php mysql gd using yum on centos6
  • CentOS 6.4 installation and configuration of LNMP server (Nginx+PHP+MySQL)
  • How to configure MySQL database server on CentOS
  • Quick solution to MySQL service startup failure under CentOS 7
  • Sharing the whole process of installing MySQL 5.5 under CentOS 5.5
  • CentOS 7 installation of mysql5.5 and the command used to install mariadb
  • Restart MariaDB with mysql under Centos7
  • CentOS 6.5 yum installation of MySQL-5.5 full process graphic tutorial

<<:  JavaScript implements asynchronous acquisition of form data

>>:  Detailed explanation of the difference between "/" and "~" in Linux

Recommend

Three common methods for HTML pages to automatically jump after 3 seconds

In practice, we often encounter a problem: how to...

Nginx server adds Systemd custom service process analysis

1. Take nginx as an example Nginx installed using...

Detailed discussion of memory and variable storage in JS

Table of contents Preface JS Magic Number Storing...

vue perfectly realizes el-table column width adaptation

Table of contents background Technical Solution S...

Summary of @ usage in CSS (with examples and explanations)

An at-rule is a declaration that provides instruc...

The most commonly used HTML escape sequence

In HTML, <, >, &, etc. have special mean...

How to safely shut down a MySQL instance

This article analyzes the process of shutting dow...

This article will help you understand JavaScript variables and data types

Table of contents Preface: Kind tips: variable 1....

Vue's detailed code for implementing the shuttle box function

Vue - implement the shuttle box function, the eff...

The process of installing Docker in Linux system

In this blog, I will walk you through the process...

Commonly used HTML format tags_Powernode Java Academy

1. Title HTML defines six <h> tags: <h1&...

Detailed explanation of screen command usage in Linux

GUN Screen: Official website: http://www.gnu.org/...