zhmg23

我们是如此的不同
资深运维工程师互荐群: 102123162

CentOS/RHEL上安装Percona-Server-server-57

1、安装percona源
yum install http://www.percona.com/downloads/percona-release/redhat/0.1-4/percona-release-0.1-4.noarch.rpm

2、安装

yum install Percona-Server-server-57

3、启动、初始化

# service mysql restart

4、获取初始登陆密码

# grep  password /var/log/mysqld.log

2018-01-04T02:29:22.386544Z 1 [Note] A temporary password is generated for root@localhost: ;BBrp>sZi21P

2018-01-04T02:29:25.864293Z 0 [Note] Execution of init_file '/var/lib/mysql/install-validate-password-plugin.PtK3Gu.sql' started.

2018-01-04T02:29:25.873833Z 0 [Note] Execution of init_file '/var/lib/mysql/install-validate-password-plugin.PtK3Gu.sql' ended.

2018-01-04T02:29:30.382134Z 0 [Note] Shutting down plugin 'sha256_password'

2018-01-04T02:29:30.382137Z 0 [Note] Shutting down plugin 'mysql_native_password'

2018-01-04T02:29:31.408481Z 3 [Note] Access denied for user 'UNKNOWN_MYSQL_USER'@'localhost' (using password: NO)

5、首次登陆修改初始密码

 

mysql> SET PASSWORD = PASSWORD('your_password'); 

mysql> grant all on *.* to root@'%' identified by 'your_password';

mysql> flush privileges;

注:如果你设置后,提示

mysql> SET PASSWORD = PASSWORD('your_password'); 

ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

说明密码长度及复杂度不够

6、修改数据存储目录

mysql> show variables like '%datadir%';

+---------------+-----------------+

| Variable_name | Value           |

+---------------+-----------------+

| datadir       | /var/lib/mysql/ |

+---------------+-----------------+

1 row in set (0.00 sec)

停止服务

# service mysql stop

修改配置

vim /etc/percona-server.conf.d/mysqld.cnf

datadir=/var/lib/mysql

修改为:

datadir=/data/mysql

拷贝源数据到目录存储路径

# cp -rf /var/lib/mysql  /data/

# chown mysql:  /data/mysql/  -R

启动数据,在次进入查询是否修改成功

在次查询mysql数据存储目录

mysql> show variables like '%datadir%';

+---------------+--------------+

| Variable_name | Value        |

+---------------+--------------+

| datadir       | /data/mysql/ |

+---------------+--------------+

1 row in set (0.00 sec)

OK,修改完成

至此,CentOS/RHEL上安装Percona-Server-server-57完成


评论