fedora mysql_Fedora server 安装Mysql8

导读

MySQL是一种关系数据库管理系统(RDBMS),作为服务器运行,提供对多个数据库的多用户访问。 这是指导,如何在Fedora 28/27/26,CentOS 7.5 / 6.10和Red Hat(RHEL)7.5 / 6.10上安装或升级MySQL社区服务器最新版本8.0(8.0.12)/5.7(5.7.23)。 本指南当然也适用于Oracle Linux和Scientific Linux。

注意:如果要升级MySQL(从早期版本),请确保备份(转储和复制)数据库和配置。 记得运行mysql_upgrade命令。

97843ff7ea16c2fadae4aa134a4063b0.png

安装 MySQL YUM 仓库源

## Fedora 28 ##

dnf install https://dev.mysql.com/get/mysql80-community-release-fc28-1.noarch.rpm

## Fedora 27 ##

dnf install https://dev.mysql.com/get/mysql80-community-release-fc27-1.noarch.rpm

## Fedora 26 ##

dnf install https://dev.mysql.com/get/mysql80-community-release-fc26-1.noarch.rpm

CentOS 和 Red Hat (RHEL)

## CentOS 7 and Red Hat (RHEL) 7 ##

yum localinstall https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm

CentOS 6 and Red Hat (RHEL) 6 ##

yum localinstall https://dev.mysql.com/get/mysql80-community-release-el6-1.noarch.rpm

安装和更新

1.安装

Fedora 28/27/26

dnf install mysql-community-server

CentOS 7.5/6.10 and Red Hat (RHEL) 7.5/6.10

yum install mysql-community-server

2.安装 MySQL 5.7.23

Fedora 28/27/26

dnf --disablerepo=mysql80-community --enablerepo=mysql57-community install mysql-community-server

CentOS 7.5/6.10 and Red Hat (RHEL) 7.5/6.10

yum --disablerepo=mysql80-community --enablerepo=mysql57-community install mysql-community-server

3. 开启 MySQL server 并设置开机自启

Fedora 28/27/26  CentOS 7.5   Red Hat (RHEL) 7.5

systemctl start mysqld.service

use restart after update

systemctl enable mysqld.service

CentOS 6.10 and Red Hat (RHEL) 6.10

/etc/init.d/mysql start

use restart after update

OR ##

service mysql start   ## use restart after update

chkconfig --levels 235 mysqld on

4. 获取初始的随机密码

grep 'A temporary password is generated for root@localhost' /var/log/mysqld.log |tail -1

Example Output:

2018-11-20T21:11:44.229891Z 1 [Note] A temporary password is generated for root@localhost: -et)QoL4MLid

And root password is: -et)QoL4MLid

5.重置密码

alter user root@localhost identified by '自定义密码';

新密码必须大小学数字特殊符号全部具备。

6. 连接本地mysql服务器

mysql -u root -p OR ## mysql -h localhost -u root -p

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值