centos7安装配置指定版本mysql

1. 下载指定版本mysql

1.1 下载地址

宿主计算机安装的是mysql community server 5.5.27版本,下载地址:https://downloads.mysql.com/archives/community/

  • 下载tar文件
    在这里插入图片描述
  • 下载rpm文件
    在这里插入图片描述

1.2 通过ftp上传到centos7中或者使用wget命令下载mysql文件

wget https://downloads.mysql.com/archives/get/file/mysql-5.5.27.tar.gz
wget https://downloads.mysql.com/archives/get/file/MySQL-server-5.5.27-1.el6.x86_64.rpm
wget https://downloads.mysql.com/archives/get/file/MySQL-client-5.5.27-1.el6.x86_64.rpm

2. 安装配置msyql

2.1 安装mysql

使用rpm命令与管道查询mysql

rpm -aq | grep -i mysql

卸载mysql

rpm -e --nodeps [rpm查询出来的包名]

安装mysql(我将rpm文件放到了/usr/local/src/mysql目录下)

cd /usr/local/src/mysql
rpm -ivh MySQL-server-5.5.27-1.el6.x86_64.rpm
rpm -ivh MySQL-client-5.5.27-1.el6.x86_64.rpm

2.2 启动mysql

查看myslq运行状态

service mysql status

启动mysql服务

service mysql start

在这里插入图片描述

2.3 修改mysql密码

在安装MySQL-server-5.5.27-1.el6.x86_64.rpm完成后会有提示如何修改密码

--第一次登录时需要给root用户设置密码
/usr/bin/mysqladmin -u root password 'new-password'

--登入mysql后可以更改密码
set password=password('password');

在这里插入图片描述

2.4 开放3306端口

开放3306端口并重新加载防火墙设置

firewall-cmd --zone=public --add-port=3306/tcp --permanent
firewall-cmd --reload
firewall-cmd --list-ports

2.5 给root分配全部权限

一般不应该给root分配所有权限

grant all privileges on *.* to 'root' @'%' identified by 'new-password'

在这里插入图片描述

2.6 宿主计算机测试连接

在这里插入图片描述

2.7 设置开启自动启动

chkconfig --add mysql
chkconfig mysql on
chkconfig | grep mysql

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值