mysql-rpm安装

部署环境

操作系统:CentOS Linux release 7.5.1804 (Core)

MYSQL版本:mysql-5.7.30-1

下载RPM安装包
下载地址

mysql5.7下载地址

在这里插入图片描述

对应组件下载
  1. 可选择 rpm-bundle.tar下载,下载后解压

    在这里插入图片描述

    tar xf mysql-5.7.30-1.el7.x86_64.rpm-bundle.tar

  2. 细化下载需要的mysql组件,有(server、client、common、libs)

    (mysql-community-server-5.7.30-1.el7.x86_64.rpm

    mysql-community-client-5.7.30-1.el7.x86_64.rpm

    mysql-community-common-5.7.30-1.el7.x86_64.rpm

    mysql-community-libs-5.7.30-1.el7.x86_64.rpm

卸载旧版本Mysql
卸载mysql
yum remove `rpm -qa|grep mysql`
卸载mariadb
yum remove  `rpm -qa|grep mariadb`
安装Mysql组件
rpm -ivh mysql-community-server-5.7.30-1.el7.x86_64.rpm mysql-community-client-5.7.30-1.el7.x86_64.rpm mysql-community-libs-5.7.30-1.el7.x86_64.rpm mysql-community-common-5.7.30-1.el7.x86_64.rpm --force --nodeps
个别服务器安装时报错
在阿里云ESC服务器上安装mysql5.7时报错如下:
[root@boke mysql]# rpm -ivh mysql-community-server-5.7.30-1.el7.x86_64.rpm mysql-community-client-5.7.30-1.el7.x86_64.rpm mysql-community-libs-5.7.30-1.el7.x86_64.rpm mysql-community-common-5.7.30-1.el7.x86_64.rpm
warning: mysql-community-server-5.7.30-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
error: Failed dependencies:
	libaio.so.1()(64bit) is needed by mysql-community-server-5.7.30-1.el7.x86_64
	libaio.so.1(LIBAIO_0.1)(64bit) is needed by mysql-community-server-5.7.30-1.el7.x86_64
	libaio.so.1(LIBAIO_0.4)(64bit) is needed by mysql-community-server-5.7.30-1.el7.x86_64
	
原因:Mysql依赖libaio,当前服务器上没libaio库
解决办法:yum -y install libaio
安装成功后,重新安装一遍mysql
登录并修改mysql密码
启动mysql
systemctl start mysqld 		启动mysql
systemctl status mysqld		查看mysql状态
systemctl stop mysqld		关闭mysql
ps -ef|grep mysql				查看mysql进程

netstat -ntpl|grep 3306		查看3306端口
登录mysql
查找mysql临时密码

[root@localhost opt]# grep 'temporary password' /var/log/mysqld.log
2020-05-07T07:20:00.475125Z 1 [Note] A temporary password is generated for root@localhost: cK0N45(p+o:p

cK0N45(p+o:p  ##登录随机密码

[root@localhost opt]# mysql -uroot -p
Enter password: 	##这里输入密码
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.30

Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
修改mysql密码
mysql> alter user user() identified by 'Ll@123456';
Query OK, 0 rows affected (0.01 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值