Linux环境多种方式安装mysql(笔记)

1.mariadb

(1)使用官方源安装 yum install mariadb-server mariadb-client -y
在这里插入图片描述
(2)启动并添加开机自启
systemctl start mariadb.service
systemctl enable mariadb.service

(3)安全插件初始化密码
/usr/bin/mysql_secure_installation

一般建议按以下进行配置:
Enter current password for root (enter for none): Just press the Enter button
Set root password? [Y/n]: Y
New password: your-MariaDB-root-password
Re-enter new password: your-MariaDB-root-password
Remove anonymous users? [Y/n]: Y
Disallow root login remotely? [Y/n]: n
Remove test database and access to it? [Y/n]: Y
Reload privilege tables now? [Y/n]: Y

(4)卸载mariadb
mysqldump -uroot -p --database database_name >name.sql

#卸载mariadb
yum remove mariadb

#删除配置文件:
rm -f /etc/my.cnf

#删除数据目录:
rm -rf /var/lib/mysql/

2.yum安装

(1)通过官网查找需要的版本和对应的平台版本https://dev.mysql.com/downloads/repo/yum/
(2)在这里插入图片描述
(3)然后在linux上输入指令
wget https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm

(4)使用以下命令安装下载的发行包:
rpm -Uvh mysql80-community-release-el7-3.noarch.rpm

(5 )列出所有版本
yum repolist all | grep mysql

发现5.7未启用,8.0才是启用的,这里我们需要安装5.7版本的,所以把8.0的进行禁用,然后再启用5.7版本

(6)先禁用8.0版本
yum-config-manager --disable mysql80-community
运行 yum-config-manager命令提示 -bash: yum-config-manager: command not found 命令未找到,因为 yum-config-manager 在 yum-utils包里面。由于系统默

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值