• 幕客老师召集小伙伴
  • 运维高手36项修炼
  • python自动化运维项目实战
  • nginx从入门到实战
  • 阿里云与Centos7实战

Centos7.2安装Percona-Server

一、介绍

mysql被oracle收购后,独立出来的两个分支,一个为Mariadb 一个为percona, percona是最结局于原版mysql的,

所以使用上等同于老板mysql。Mariadb由于作了改动稍大,所以为了尽量保持原有习惯,可以选择用percona.

 

二、下载

官方网站:https://www.percona.com/downloads/Percona-Server-LATEST/

# cd /opt/download/
# wget https://www.percona.com/downloads/Percona-Server-LATEST/Percona-Server-5.7.19-17/binary/redhat/7/x86_64/release-5.7.19-17-re19a6b7b73f-el7-x86_64-bundle.tar
# tar -xvf release-5.7.19-17-re19a6b7b73f-el7-x86_64-bundle.tar
# 

三、安装

# rpm -ivh ./Percona-Server-*
警告:./Percona-Server-57-debuginfo-5.7.19-17.1.el7.x86_64.rpm: 头V4 DSA/SHA1 Signature, 密钥 ID cd2efd2a: NOKEY
错误:依赖检测失败:
        mariadb-libs 被 Percona-Server-shared-compat-57-5.7.19-17.1.el7.x86_64 取代
        perl(JSON) 被 Percona-Server-test-57-5.7.19-17.1.el7.x86_64 需要
        jemalloc >= 3.3.0 被 Percona-Server-tokudb-57-5.7.19-17.1.el7.x86_64 需要

安装如上,如果出现这些错误日式那么需要进行对应的修复:

1、mariadb-libs 被 Percona-Server-shared-compat-57-5.7.19-17.1.el7.x86_64 取代

我们需要卸载,机器上已经安装mysql或者mariadb

# yum remove mariadb-libs

2、perl(JSON) 被 Percona-Server-test-57-5.7.19-17.1.el7.x86_64 需要

yum -y install perl-Module-Install
yum install perl-JSON

3、jemalloc >= 3.3.0 被 Percona-Server-tokudb-57-5.7.19-17.1.el7.x86_64 需要

yum install jemalloc-devel

 

再一次安装,正常如下:

[root@Jeson-at-imoocc download]# rpm -ivh ./Percona-Server-*
警告:./Percona-Server-57-debuginfo-5.7.19-17.1.el7.x86_64.rpm: 头V4 DSA/SHA1 Signature, 密钥 ID cd2efd2a: NOKEY
准备中...                          ################################# [100%]
正在升级/安装...
   1:Percona-Server-shared-compat-57-5################################# [ 11%]
   2:Percona-Server-shared-57-5.7.19-1################################# [ 22%]
   3:Percona-Server-client-57-5.7.19-1################################# [ 33%]

 

接下来进行percona数据库的初始化,如下:

[root@Jeson-at-imoocc download]# /usr/bin/mysql_install_db --defaults-file=/etc/my.cnf --basedir=/usr/local/mysql --datadir=/var/lib/mysql --user=mysql
2017-09-10 18:07:20 [WARNING] mysql_install_db is deprecated. Please consider switching to mysqld --initialize
2017-09-10 18:07:20 [ERROR]   The data directory '/var/lib/mysql' already exist and is not empty.
///var/lib/mysql如果提示目录存在需要将老的删除、或者备份

[root@Jeson-at-imoocc download]# mv /var/lib/mysql /var/lib/mysql_bak
[root@Jeson-at-imoocc download]# /usr/bin/mysql_install_db --defaults-file=/etc/my.cnf --basedir=/usr/local/mysql --datadir=/var/lib/mysql --user=mysql
2017-09-10 18:07:43 [WARNING] mysql_install_db is deprecated. Please consider switching to mysqld --initialize

启动服务:

[root@Jeson-at-imoocc download]# systemctl start mysqld
[root@Jeson-at-imoocc download]# ps -aux|grep mysql
mysql     6932 15.7  2.3 1171708 184528 ?      Sl   18:11   0:01 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid
root      6963  0.0  0.0 112664   972 pts/2    S+   18:11   0:00 grep --color=auto mysql

四、测试

1、连接到服务端

root密码会在/var/log/mysqld.log中,可以这么查找:

cat /var/log/mysqld.log |grep -i 'pass'

 

但是我怎么也没找到,只能考虑重置,方法如下:

[root@Jeson-at-imoocc download]# vim /etc/percona-server.conf.d/mysqld.cnf 
添加:
skip-grant-tables

mysql> update user set authentication_string=PASSWORD('jeson') where user='root'
    -> ;
Query OK, 1 row affected, 1 warning (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 1

重启服务
[root@Jeson-at-imoocc download]# systemctl stop mysqld
[root@Jeson-at-imoocc download]# systemctl start mysqld

用密码登陆,如下:
[root@Jeson-at-imoocc download]# mysql -uroot -p'jeson'
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.19-17

Copyright (c) 2009-2017 Percona LLC and/or its affiliates
Copyright (c) 2000, 2017, 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> 

 

Centos7.2安装Percona-Server

Pingbacks已打开。

引用地址

暂无评论

发表评论