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

Creating a file system for ARM development board under Linux

1. Please download the Busybox source code online...

Detailed explanation of Nodejs array queue and forEach application

This article mainly records the problems and solu...

Using keras to judge SQL injection attacks (example explanation)

This article uses the deep learning framework ker...

Detailed tutorial on installing Mysql5.7.19 on Centos7 under Linux

1. Download MySQL URL: https://dev.mysql.com/down...

Embed player in web page embed element autostart false invalid

Recently, I encountered the need to embed a player...

JavaScript to achieve mouse drag effect

This article shares the specific code of JavaScri...

JavaScript two pictures to understand the prototype chain

Table of contents 1. Prototype Relationship 2. Pr...

How to change apt-get source in Ubuntu 18.04

When using apt-get to install, it will be very sl...

Example code for implementing a pure CSS pop-up menu using transform

Preface When making a top menu, you will be requi...

Solve the problem of docker container exiting immediately after starting

Recently I was looking at how Docker allows conta...

How to modify the forgotten password when installing MySQL on Mac

1. Install MySQL database on mac 1. Download MySQ...