Centos7 安装 Mysql8教程

 更新时间:2020年08月13日 10:34:58   作者:yunfeiyun  
这篇文章主要介绍了Centos7 安装 Mysql8的教程,帮助大家的日常工作与学习,感兴趣的朋友可以了解下

Mysql8新特性:

Mysql从5.x版本直接跳跃到8.x,我个人是这么看的:

MySQL 5.5 -> MySQL 5
MySQL 5.6 -> MySQL 6
MySQL 5.7 -> MySQL 7
MySQL 8.0 -> MySQL 8

当然也有可能是Mysql6、7内部难产了-_-,自从被Oracle收购后,活力依旧在,mysql8有以下新特性:

  • MySQL 文档存储
  • 默认 utf8mb4 编码
  • JSON 增强
  • CTEs(译者注:Common Table Expresssions 公共表格表达式)
  • 窗口函数
  • 降序索引
  • 更好的优化器消费模型
  • MySQL 服务器组件
  • GIS(译者注:Geographic Information System 地理信息系统) 提升
  • InnoDB 引擎的 NO WAIT 和 SKIP \ LOCKED 选项

Centos7 Mysql8安装步骤:

1、设置mysql源

首先,您需要在MySQL提供的系统中启用MySQL yum存储库。 根据您的操作系统版本执行以下命令之一,这里我们选择CentOS 7 / RHEL 7的源

###在CentOS 7 / RHEL 7系统上### 
rpm -Uvh https://repo.mysql.com/mysql80-community-release-el7-3.noarch.rpm

###在CentOS 7 / RHEL 6系统上### 
rpm -Uvh https://repo.mysql.com/mysql80-community-release-el6-3.noarch.rpm

###在Fedora 30系统上### 
rpm -Uvh https://repo.mysql.com/mysql80-community-release-fc30-1.noarch.rpm

###在Fedora 29系统上### 
rpm -Uvh https://repo.mysql.com/mysql80-community-release-fc29-2.noarch.rpm

###在Fedora 28系统上### 
rpm -Uvh https://repo.mysql.com/mysql80-community-release-fc28-2.noarch.rpm

2、安装MySQL Community Server

MySQL yum存储库包含用于多个MySQL版本的多个存储库配置。 因此,首先禁用mysql repo文件中的所有存储库

sed -i 's/enabled=1/enabled=0/' /etc/yum.repos.d/mysql-community.repo

启用centos mysql8版本

## CentOS & RedHat 版本
yum --enablerepo=mysql80-community install mysql-community-server
## Fedora Systems 版本
dnf --enablerepo=mysql80-community install mysql-community-server

3、启动MySQL服务

service mysqld start

使用Systemd

systemctl start mysqld.service

4、查找MySQL root密码

安装MySQL 8.0后,将为MySQL根用户创建一个临时密码。 您可以在日志文件中找到生成的临时密码。密码文件位置:/var/log/mysqld.log

grep "A temporary password" /var/log/mysqld.log

5、重置root密码

首次安装MySQL后,执行mysql_secure_installation命令以保护MySQL服务器,包含重置密码步骤

mysql_secure_installation
Enter password for user root:

The existing password for the user account root has expired. Please set a new password.

New password:
Re-enter new password:

Remove anonymous users? (Press y|Y for Yes, any other key for No) : y

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y

Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y

6、mysql 服务加入开机启动项,并启动mysql进程

### Using Systemd
systemctl enable mysqld.service
systemctl restart mysqld.service

7、开放3306端口

如果服务器开启了防火墙,记得开启3306端口

systemctl enable iptables
systemctl start iptables
vim /etc/sysconfig/iptables
##规则中加入
-A INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT
##重启防火墙
systemctl enable iptables.service
systemctl start iptables.service

如果使用的腾讯云的服务器,一定记得开启安全组里的端口

附mysql常用命令:

登录mysql

mysql -u username -p

启动mysql

systemctl start mysqld.service

结束mysql

systemctl stop mysqld.service

重启mysql

systemctl restart mysqld.service

开机自启

systemctl enable mysqld.service

以上就是Centos7 安装 Mysql8教程的详细内容,更多关于Centos7 安装 Mysql8的资料请关注脚本之家其它相关文章!

相关文章

  • linux中数据库的定时备份

    linux中数据库的定时备份

    这篇文章主要介绍了linux中数据库的定时备份的相关资料,需要的朋友可以参考下
    2023-05-05
  • linux手动、自动更改网卡MAC地址的方法

    linux手动、自动更改网卡MAC地址的方法

    这篇文章主要给大家介绍了关于linux如何手动、自动更改网卡MAC地址的相关资料,文中通过示例代码介绍的非常详细,对大家学习或者使用linux具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
    2018-06-06
  • Linux下部署springboot项目的方法步骤

    Linux下部署springboot项目的方法步骤

    这篇文章主要介绍了Linux下部署springboot项目的方法步骤,由于springboot是内嵌了tomcat,所以可以直接将项目打包上传至服务器上,具体实例方法大家参考下本文
    2018-06-06
  • centos系统安装Kubernetes集群步骤

    centos系统安装Kubernetes集群步骤

    大家好,本篇文章主要讲的是centos系统安装Kubernetes集群步骤,感兴趣的同学赶快来看一看吧,对你有帮助的话记得收藏一下,方便下次浏览
    2022-01-01
  • 基于Linux系统中查看硬件等信息的方法详解

    基于Linux系统中查看硬件等信息的方法详解

    本篇文章是对Linux系统中查看硬件等信息的方法进行了详细的分析介绍,需要的朋友参考下
    2013-06-06
  • git bash配置ssh 登录 Linux的方法

    git bash配置ssh 登录 Linux的方法

    今天小编就为大家分享一篇git bash配置ssh 登录 Linux的方法,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧
    2019-07-07
  • 详解linux ntp服务器时间同步设置

    详解linux ntp服务器时间同步设置

    这篇文章主要介绍了linux ntp服务器时间同步设置的相关资料,需要的朋友可以参考下
    2017-07-07
  • Linux中logrotate日志轮询操作总结

    Linux中logrotate日志轮询操作总结

    这篇文章主要给大家介绍了在Linux中logrotate日志轮询操作的相关资料,文中通过示例代码介绍的非常详细,对大家具有一定的参考学习价值,需要的朋友们下面来一起看看吧。
    2017-06-06
  • Ubuntu系统网络故障排查的方法

    Ubuntu系统网络故障排查的方法

    最近在使用Ubuntu系统的时候碰到一个问题,连接无线网络的时候,发现右上角网络设置中没有 Enable Wi-Fi 这个选项了,所以通过一步步排查,终于找了解决办法,现在分享给大家,有需要的朋友们可以参考借鉴。
    2016-10-10
  • linux特殊字符及其作用大全

    linux特殊字符及其作用大全

    这篇文章主要介绍了linux特殊字符及其作用,文中给大家补充介绍了linux特殊字符用法,需要的朋友可以参考下
    2018-04-04

最新评论