Mysql5.7 rpm离线安装

下载rpm bundle包

  1. https://mirrors.tuna.tsinghua.edu.cn/mysql/downloads/MySQL-5.7/mysql-5.7.32-1.sles12.x86_64.rpm-bundle.tar

卸载CentOS7系统自带的mariadb

  1. > rpm -qa|grep mariadb
  2. > rpm -e --nodeps mariadb-libs-5.5.60-1.el7_5.x86_64

安装依赖

  1. > yum install perl* cpan net-tools libaio -y

通过rpm安装mysql

rpm 安装顺序为:common >> libs >> client >> server

  1. > rpm -ivh mysql-community-common-5.7.30-1.el7.x86_64.rpm
  2. > rpm -ivh mysql-community-libs-5.7.30-1.el7.x86_64.rpm
  3. > rpm -ivh mysql-community-client-5.7.30-1.el7.x86_64.rpm
  4. > rpm -ivh mysql-community-server-5.7.30-1.el7.x86_64.rpm

修改目录权限

rpm 默认是以mysql用户启动的,mysql的安装目录,数据目录都要保证有足够的权限

  1. > chown mysql:mysql -R /var/log/mysql

启动MySQL服务,记录初始密码

  1. > systemctl start mysqld
  2. > cat /var/log/mysqld.log |grep password
  3. xxxxx

登录MySQL修改密码

需要用到上一步的初始密码

  1. > mysql -uroot -pxxxxx
  2. mysql> alter user 'root'@'localhost' identified by '123456';
  3. mysql> flush privileges;

返回笔记列表
入门小站