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

XHTML Getting Started Tutorial: Using the Frame Tag

<br />The frame structure allows several web...

Element table header row height problem solution

Table of contents Preface 1. Cause of the problem...

Vue implements zoom in, zoom out and drag function

This article example shares the specific code of ...

Common methods of Vue componentization: component value transfer and communication

Related knowledge points Passing values ​​from pa...

WeChat applet realizes simple tab switching effect

This article shares the specific code for WeChat ...

js to write the carousel effect

This article shares the specific code of js to ac...

Detailed steps to use Redis in Docker

1. Introduction This article will show you how to...

How to decrypt Linux version information

Displaying and interpreting information about you...

JavaScript to achieve tab switching effect

This article shares the specific code of JavaScri...

MySQL slow query method and example

1. Introduction By enabling the slow query log, M...

Web Design Tutorial (4): About Materials and Expressions

<br />Previous Web Design Tutorial: Web Desi...

How to add color mask to background image in CSS3

Some time ago, during development, I encountered ...

The difference and usage of distinct and row_number() over() in SQL

1 Introduction When we write SQL statements to op...