Percona Server5.7.17二进制安装_for redhat 6.1

Percona Server5.7.17二进制安装_for redhat 6.1

系统环境         
系统:Redhat 6.1  
二进制安装包:Percona-Server-5.7.17-11-Linux.x86_64.ssl101.tar.gz


1.环境准备
mkdir -p /mysql/Percona
mkdir -p /mysql/Percona/data

groupadd mysql
useradd mysql -g mysql -d /home/mysql -s /sbin/nologin
chown mysql:mysql /mysql -R

2.Percona安装配置

tar -zxvf Percona-Server-5.7.17-11-Linux.x86_64.ssl101.tar.gz -C /mysql/Percona
mv Percon** Server


cp /mysql/Percona/Server/support-files/my-default.cnf /etc/my.cnf
vi /etc/my.cnf  
# These are commonly set, remove the # and set as required.
basedir = /mysql/Percona/Server
datadir = /mysql/Percona/data
port = 3309
log-error=/mysql/Percona/data/mysqld.log
# server_id = .....
socket = /mysql/Percona/data/mysql.sock


3.Percona初始化(Redhat 6.5初始化顺利)
报错1: 
# /mysql/Percona/Server/bin/mysqld --initialize-insecure --user=mysql --basedir=/mysql/Percona/Server --datadir=/mysql/Percona/data
/usr/local/percona/bin/mysqld: error while loading shared libraries: libnuma.so.1: cannot open shared object file: No such file or directory
解决报错:
yum search libnuma
numactl.i686 : Library for tuning for Non Uniform Memory Access machines
numactl.x86_64 : Library for tuning for Non Uniform Memory Access machines
numactl-devel.i686 : Development package for building Applications that use numa
numactl-devel.x86_64 :…………
建本地yum源
yum install numactl.i686 numactl.x86_64 numactl-devel.i686 numactl-devel.x86_64

报错2: 
# /mysql/Percona/Server/bin/mysqld --initialize-insecure --user=mysql --basedir=/mysql/Percona/Server --datadir=/mysql/Percona/data
/mysql/Percona/Server/bin/mysqld: /lib64/libz.so.1: no version information available (required by /mysql/Percona/Server/bin/mysqld)
/mysql/Percona/Server/bin/mysqld: /usr/lib64/libssl.so.10: no version information available (required by /mysql/Percona/Server/bin/mysqld)
/mysql/Percona/Server/bin/mysqld: /usr/lib64/libcrypto.so.10: no version information available (required by /mysql/Percona/Server/bin/mysqld)
/mysql/Percona/Server/bin/mysqld: /usr/lib64/libcrypto.so.10: no version information available (required by /mysql/Percona/Server/bin/mysqld)
..........

1)解决报错:lib64/libz.so.1: no version information available
从http://zlib.NET/下载最新版本
wget http://zlib.net/zlib-1.2.11.tar.gz  
tar zxvf zlib-1.2.11.tar.gz  
cd zlib-1.2.11.tar.gz  
./configure  
make  
make install  
  
#覆盖原版本,可以先备份一下原版本  
cp /usr/local/lib/libz.so.1.2.11 /lib64/
ln -s  libz.so.1.2.11 libz.so.1 


2) 解决报错/usr/lib64/lib* no version information available
下载 openssl-1.0.1:
http://pkgs.org/centos-7/centos-x86_64/openssl-libs-1.0.1e-42.el7.x86_64.rpm/download/
安装
rpm -ivh openssl-1.0.1e-42.el6.x86_64.rpm --force
卸载老版本
rpm -e openssl-1.0.0-27.el6.x86_64


注意)安装高版本的openssl有可能导致与系统不兼容,使得ssh无法登录,ssh无法登录后可以进入单用户模式挂载IOS后用yum安装以前的openssh恢复。

4.重新初始化 (删除/mysql/Percona/data下的所用数据)。
# /mysql/Percona/Server/bin/mysqld --initialize-insecure --user=mysql --basedir=/mysql/Percona/Server --datadir=/mysql/Percona/data
2017-03-10T02:02:07.873616Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is depr
ecated. Please use --explicit_defaults_for_timestamp server option (see documentation
 for more details).
2017-03-10T02:02:07.875234Z 0 [Warning] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_
FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged 
with strict mode in a future release.
2017-03-10T02:02:07.875271Z 0 [Warning] 'NO_AUTO_CREATE_USER' sql mode was not set.
2017-03-10T02:02:11.637079Z 0 [Warning] InnoDB: New log files created, LSN=45790
2017-03-10T02:02:12.241603Z 0 [Warning] InnoDB: Creating foreign key constraint syste
m tables.
2017-03-10T02:02:12.680758Z 0 [Warning] No existing UUID has been found, so we assume
 that this is the first time that this server has been started. Generating a new UUID
: 93a8c643-0535-11e7-b71a-000c29e925bb.
2017-03-10T02:02:12.687743Z 0 [Warning] Gtid table is not ready to be used. Table 'my
sql.gtid_executed' cannot be opened.
2017-03-10T02:02:13.237357Z 0 [Warning] CA certificate ca.pem is self signed.
2017-03-10T02:02:13.386179Z 1 [Warning] root@localhost is created with an empty passw
ord ! Please consider switching off the --initialize-insecure option.

5.启动数据库
[root@asmoracle Server]# mysqld_safe --user=mysql --defaults-file=/etc/my.cnf 
 mysqld_safe Adding '/mysql/Percona/Server/lib/mysql/libjemalloc.so.1' to LD_PRELOAD for mysqld
2017-03-10T02:21:54.174287Z mysqld_safe Logging to '/mysql/Percona/data/mysqld.log'.
2017-03-10T02:21:54.177252Z mysqld_safe Logging to '/mysql/Percona/data/mysqld.log'.
2017-03-10T02:21:54.180522Z mysqld_safe The file /usr/local/Percona-Server-5.7.17-11-Linux.x86_64.ssl101/bin/mysqld
does not exist or is not executable. Please cd to the mysql installation
directory and restart this script from there as follows:
./bin/mysqld_safe&
See http://dev.mysql.com/doc/mysql/en/mysqld-safe.html for more information
按提示启动数据库成功:
[root@asmoracle Server]# ./bin/mysqld_safe 
 mysqld_safe Adding '/mysql/Percona/Server/lib/mysql/libjemalloc.so.1' to LD_PRELOAD for mysqld
2017-03-10T02:24:19.727034Z mysqld_safe Logging to '/mysql/Percona/data/mysqld.log'.
2017-03-10T02:24:19.732047Z mysqld_safe Logging to '/mysql/Percona/data/mysqld.log'.
2017-03-10T02:24:19.925647Z mysqld_safe Starting mysqld daemon with databases from /mysql/Percona/data

6.验证新安装的Percona
1) 查看进程 
[root@asmoracle ~]# ps -ef | grep mysql
root      2658  1668  0 10:24 pts/0    00:00:00 /bin/sh ./bin/mysqld_safe
mysql     2800  2658  4 10:24 pts/0    00:00:02 ./bin/mysqld --basedir=/mysql/Percona/Server --datadir=/mysql/Percona/data --plugin-dir=/mysql/Percona/Server/lib/mysql/plugin --user=mysql --log-error=/mysql/Percona/data/mysqld.log --pid-file=/mysql/Percona/data/asmoracle.pid --socket=/mysql/Percona/data/mysql.sock --port=3309
2)登录数据库
[root@asmoracle ~]# mysql --socket=/mysql/Percona/data/mysql.sock
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.17-11 Percona Server (GPL), Release 11, Revision f60191c


Copyright (c) 2009-2016 Percona LLC and/or its affiliates
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.


Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.


Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.00 sec)


mysql> use mysql
mysql> select host,user from users;
ERROR 1146 (42S02): Table 'mysql.users' doesn't exist
mysql> select host,user from user
    -> ;
+-----------+-----------+
| host      | user      |
+-----------+-----------+
| localhost | mysql.sys |
| localhost | root      |
+-----------+-----------+
2 rows in set (0.00 sec)


mysql> set password = password('root1234');
Query OK, 0 rows affected, 1 warning (0.00 sec)


mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> select user();
+----------------+
| user()         |
+----------------+
| root@localhost |
+----------------+
1 row in set (0.00 sec)


3)重新登录数据库
[root@asmoracle ~]# mysql -uroot -p --socket=/mysql/Percona/data/mysql.sock
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.17-11 Percona Server (GPL), Release 11, Revision f60191c


Copyright (c) 2009-2016 Percona LLC and/or its affiliates
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.


Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.


Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.


mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.00 sec)


你可能感兴趣的:(MySQL)