Linux安装MySQL

本次安装的是mysql-5.7.27-1.el6.x86_64.rpm-bundle.tar

  1. 官方下载地址:

wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.20-1.el6.x86_64.rpm-bundle.tar

  1. 解压

tar -xvf mysql-5.7.20-1.el6.x86_64.rpm-bundle.tar

  1. 卸载之前的版本

rpm -qa | grep -i mysql
rpm -e xxxxx [之前安装的版本] --nodeps 要卸载的mysql版本

  1. 按照步骤来安装就好

1.rpm -ivh mysql-community-libs-5.7.20-1.el6.x86_64.rpm --nodeps --force
2.rpm -ivh mysql-community-devel-5.7.20-1.el6.x86_64.rpm --nodeps --force
3.rpm -ivh mysql-community-client-5.7.20-1.el6.x86_64.rpm --nodeps --force
4.rpm -ivh mysql-community-server-5.7.20-1.el6.x86_64.rpm --nodeps --force

安装最后一个时出现报错

rpm -ivh mysql-community-server-5.7.19-1.el7.x86_64.rpm 
报错:
warning: mysql-community-server-5.7.19-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
error: Failed dependencies:
        /usr/bin/perl is needed by mysql-community-server-5.7.19-1.el7.x86_64
        libaio.so.1()(64bit) is needed by mysql-community-server-5.7.19-1.el7.x86_64
        libaio.so.1(LIBAIO_0.1)(64bit) is needed by mysql-community-server-5.7.19-1.el7.x86_64
        libaio.so.1(LIBAIO_0.4)(64bit) is needed by mysql-community-server-5.7.19-1.el7.x86_64
        net-tools is needed by mysql-community-server-5.7.19-1.el7.x86_64
        perl(Getopt::Long) is needed by mysql-community-server-5.7.19-1.el7.x86_64
        perl(strict) is needed by mysql-community-server-5.7.19-1.el7.x86_64

缺少net-tools.x86_64,libaio.x86_64,perl.x86_64三个依赖,使用yum安装即可。

yum -y install perl.x86_64
yum install -y libaio.x86_64
yum -y install net-tools.x86_64

接着报错

[root@localhost ~]# rpm -ivh mysql-community-server-5.7.23-1.el6.x86_64.rpm 
warning: mysql-community-server-5.7.23-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
error: Failed dependencies:
        libnuma.so.1()(64bit) is needed by mysql-community-server-5.7.23-1.el6.x86_64
        libnuma.so.1(libnuma_1.1)(64bit) is needed by mysql-community-server-5.7.23-1.el6.x86_64
        libnuma.so.1(libnuma_1.2)(64bit) is needed by mysql-community-server-5.7.23-1.el6.x86_64
        mysql-community-client(x86-64) >= 5.7.9 is needed by mysql-community-server-5.7.23-1.el6.x86_64
        mysql-community-common(x86-64) = 5.7.23-1.el6 is needed by mysql-community-server-5.7.23-1.el6.x86_64

缺少依赖!!!安装

yum -y install numactl

启动数据库

# 查看mysql是否启动
service mysqld status

# 启动mysql
service mysqld start

# 停止mysql
service mysqld stop

# 重启mysql
service mysqld restart

进入mysql

获取临时密码:

grep 'temporary password' /var/log/mysqld.log

框内第一个为用户名,第二个为临时密码
在这里插入图片描述
首先进入mysql

mysql -uroot -p 临时密码

将root的密码改为root

ALTER USER 'root'@'localhost' IDENTIFIED BY 'root'; 

开启远程访问:

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'IDENTIFIED BY 'root' WITH GRANT OPTION;

刷新权限:

flush privileges;
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值