安装percona 5.7

来源:互联网 发布:小米4c可以4g网络吗 编辑:程序博客网 时间:2024/06/13 04:48

环境搭建二

  • 安装数据库mysql percona 5.7

安装percona 5.7

  • 首先,你需要设置Percona的Yum库:
yum install http://www.percona.com/downloads/percona-release/redhat/0.1-4/percona-release-0.1-4.noarch.rpm

image

  • 接下来安装Percona:
yum install Percona-Server-client-57 Percona-Server-server-57
  • 上面的命令安装Percona的服务器和客户端、共享库,可能需要Perl和Perl模块,以及其他依赖的需要,如DBI::MySQL
wget -r -l 1 -nd -A rpm -R "*devel*,*debuginfo*" \https://www.percona.com/downloads/Percona-Server-LATEST/Percona-Server-5.7.20-18/binary/redhat/7/x86_64/使用rpm工具,一次性安装所有的rpm包:rpm -ivh Percona-Server-server-57-5.7.20-18.1.el7.x86_64.rpm \Percona-Server-client-57-5.7.20-18.1.el7.x86_64.rpm \Percona-Server-shared-57-5.7.20-18.1.el7.x86_64.rpm

查看默认启动的服务

# systemctl list-unit-files|grep enabled查看监听端口# netstat -lntp

image

  • 启动数据库并设置开机启动
# service mysqld restart #systemctl start  mysqld.service
  • 获取默认密码
# cat /var/log/mysqld.log  | grep "A temporary password" | awk -F " " '{print$11}'访问mysql# mysql -uroot -pQzc%ooeze8.u设置密码SET PASSWORD = PASSWORD('密码');

授予root远程连接权限

默认root只运行本地访问use mysqlselect user,host from user where user='root';授予root远程连接权限,生产环境慎用GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '密码' WITH GRANT OPTION;

CentOS 7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙。

1、关闭firewall:systemctl stop firewalld.servicesystemctl disable firewalld.servicesystemctl mask firewalld.service2、安装iptables防火墙yum install iptables-services -y3.启动设置防火墙# systemctl enable iptables# systemctl start iptables4.查看防火墙状态systemctl status iptables5编辑防火墙,增加端口vi /etc/sysconfig/iptables #编辑防火墙配置文件-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT-A INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT:wq! #保存退出3.重启配置,重启系统systemctl restart iptables.service #重启防火墙使配置生效systemctl enable iptables.service #设置防火墙开机启动
原创粉丝点击