Cenost7 Mysql5.7 安装 并打开远程访问

MySql5.7

  • 下载MySql yum 源
wget https://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm
  • 安装repo
rpm -ivh mysql57-community-release-el7-9.noarch.rpm
  • 查看可安装的版本
yum repolist all| grep mysql

  • 5.7 已经启用,想要修改其他版本源,可以直接修改对应的yum.repo文件
vim /etc/yum.repos.d/mysql-community.repo
  • 安装 mysql
yum install -y mysql-community-server


太慢了...

wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-community-server-5.7.28-1.el7.x86_64.rpm
wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-community-client-5.7.26-1.el7.x86_64.rpm
wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-community-common-5.7.26-1.el7.x86_64.rpm
wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-community-libs-5.7.26-1.el7.x86_64.rpm

对了,原文博主是用迅雷下的,为什么我用wget下的这么快
  • 舒服了

  • 总算可以装了

  • 安装顺序

安装顺序 common-->libs-->client-->server
rpm -ivh mysql-community-common-5.7.26-1.el7.x86_64.rpm --force --nodeps
rpm -ivh mysql-community-libs-5.7.26-1.el7.x86_64.rpm --force --nodeps
rpm -ivh mysql-community-client-5.7.26-1.el7.x86_64.rpm --force --nodeps
rpm -ivh mysql-community-server-5.7.28-1.el7.x86_64.rpm --force --nodeps

配置

  • 启动服务
systemctl start mysqld
  • 找到初始密码
cat /var/log/mysqld.log |grep password
密码最好手打,别复制

  • 更改密码 远程访问权限
ALTER USER 'root'@'localhost' IDENTIFIED BY 'Root123@';
grant all privileges on *.* to 'root'@'%' identified by 'Root123@' with grant option;
  • firewalld iptables
  • win10测试 cmd下执行telnet 192.168.10.130 3306
iptables 与 firewalld 都不是真正的防火墙, 它们都只是用来定义防火墙策略的防火墙管理工具,是一种服务。

systemctl stop firewalld
systemctl disable firewalld
iptables -F
iptables -X
iptables -Z
/usr/sbin/iptables-save  

nginx

posted @ 2019-12-29 16:38  陈及北  阅读(426)  评论(0编辑  收藏  举报