Mysql在线离线安装

1、Linux mysql安装

(1)清理环境》》清理已安装的mysql/mariadb服务

#查看已经安装的mysql/mariadb

rpm -qa |grep -i mysql

rpm -qa |grep -i mariadb

rpm -e --nodeps 加上上面搜索到的结果,把mariadb/mysql包清掉

(2)在线安装

#下载mysql5.7,更多版本https://repo.mysql.com

wget https://repo.mysql.com/mysql57-community-release-el7-10.noarch.rpm

#添加本地repo

rpm -ivh mysql57-community-release-el7-10.noarch.rpm

#安装

yum check-update

yum update

yum install mysql mysql-server -y

(3)离线安装

(4)下载地址:

https://downloads.mysql.com/archives/community/

(5)解压

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

(6)安装

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

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

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

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

(7)启动

#启动,开机启动 mysql

systemctl start mysqld

systemctl enable mysqld

systemctl status mysqld

(8)获取自动生成的临时密码

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

(9)登录

mysql -u root -p

(10)修改密码并授权

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

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '密码';

GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY '密码' WITH GRANT OPTION;

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值