1. Percona数据库系统支持
Percona Server数据库只支持Linux系统,不能在其他系统上安装
2. 从官网下载Percona5.7
地址:https://www.percona.com/downloads/Percona-Server-5.7/LATEST/
3. 解压压缩包上传到服务器
4. 下载jemalloc包上传到服务器
我们还需要下载一个jemalloc-3.6.0-8.el7.centos.x86_64
5. RPM安装Percona Server
yum localinstall *.rpm
6. 管理mysql服务
使用systemctl start mysqld命令启动percona
systemctl start mysqld
systemctl stop mysqld
systemctl restart mysqld
7. 系统开放3306端口
firewall-cmd --zone=public --add-port=3306/tcp --permanent
firewall-cmd --reload
8. 修改mysql配置文件
我们查看一下percona的配置文件的路径在哪里,查看etc文件
cat /etc/my.cnf
进入 /etc/percona-server.conf.d/目录
cd /etc/percona-server.conf.d/
在mysqld.cnf文件中添加以下内容
[mysqld]
character_set_server = utf8
bind-address = 0.0.0.0
#跳过DNS解析
skip-name-resolve
重启mysql服务
systemctl restart mysqld
9. 禁止开机启动MySQL
chkconfig mysqld off
10. 修改root用户默认密码
10.1 查看MySQL初始密码
cat /var/log/mysqld.log | grep "A temporary password"
初始密码是)Oaa*nghh5pw,复制这个密码,后边修改是会用到
10.2 修改MySQL密码
mysql_secure_installation
输入新密码,新密码需要有大小写字母加数组,我们这里设置Abc_123456
后边有一些初始化的操作,所有都输入y
11. 创建远程管理员账户
root账户默认不允许远程连接,所以我们创建一个可以远程连接的账户
进入mysql
mysql -u root -p
创建新用户赋予远程连接权限
CREATE USER 'admin'@'%' IDENTIFIED BY 'Abc_123456';
GRANT all privileges ON *.* TO 'admin'@'%';
FLUSH PRIVILEGES;
12. 测试连接
13. 补充mysql找回root账户密码
1. 修改配置文件
修改配置文件添加skip-grant-tables
vi /etc/percona-server.conf.d/mysqld.cnf
2. 重启mysql服务
systemctl restart mysqld
3. 修改密码
进入mysql
mysql
use mysql;
update mysql.user set authentication_string=password('MLZ-pass123456') where user='root';
FLUSH PRIVILEGES;
修改成功推出
exit
4. 删除配置文件中的skip-grant-tables
删除配置文件中的skip-grant-tables
vi /etc/percona-server.conf.d/mysqld.cnf
5. 重启mysql
systemctl restart mysqld
6. 测试新密码
这篇博客只是介绍一下percona的安装方法,在后续的pxc集群中,不需要安装percona数据库,因为pxc集群已经添加了percona的依赖。