CentOS7.8安装mysql 8.0.20的教程详解

一、安装mysql软件

下载并安装MySQL官方的 Yum Repository,Mysql版本8.0.20

wget -i -c
http://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm

下载后直接yum安装

yum -y install mysql80-community-release-el7-3.noarch.rpm

安装MySQL服务器

yum -y install mysql-community-server
[root@CentOS Linux]# yum -y install mysql-community-server
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirror.lzu.edu.cn
 * extras: mirror.lzu.edu.cn
 * updates: mirror.lzu.edu.cn
mysql-connectors-community            | 2.5 kB 00:00:00
mysql-tools-community             | 2.5 kB 00:00:00
mysql80-community              | 2.5 kB 00:00:00
(1/3): mysql-connectors-community/x86_64/primary_db      | 57 kB 00:00:00
mysql-tools-community/x86_64/p FAILED           B 00:51:07 ETA
http://repo.mysql.com/yum/mysql-tools-community/el/7/x86_64/repodata/12bd1e8730cd532791529877bf5e7babbbb02879-primary.sqlite.bz2: [Errno 12] Timeout on http://repo.mysql.com/yum/mysql-tools-community/el/7/x86_64/repodata/12bd1e8730cd532791529877bf5e7babbbb02879-primary.sqlite.bz2: (28, 'Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds')
Trying other mirror.
(2/3): mysql-tools-community/x86_64/primary_db       | 72 kB 00:00:00
mysql80-community/x86_64/prima FAILED           B 00:00:15 ETA
http://repo.mysql.com/yum/mysql-8.0-community/el/7/x86_64/repodata/833c637b3989c2dd5a079a045177d2f1c96e9c1e-primary.sqlite.bz2: [Errno 12] Timeout on http://repo.mysql.com/yum/mysql-8.0-community/el/7/x86_64/repodata/833c637b3989c2dd5a079a045177d2f1c96e9c1e-primary.sqlite.bz2: (28, 'Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds')
Trying other mirror.
(3/3): mysql80-community/x86_64/primary_db        | 107 kB 00:00:00
Resolving Dependencies
--> Running transaction check
---> Package mysql-community-server.x86_64 0:8.0.20-1.el7 will be installed
--> Processing Dependency: mysql-community-common(x86-64) = 8.0.20-1.el7 for package: mysql-community-server-8.0.20-1.el7.x86_64
--> Processing Dependency: mysql-community-client(x86-64) >= 8.0.11 for package: mysql-community-server-8.0.20-1.el7.x86_64
--> Running transaction check
---> Package mysql-community-client.x86_64 0:8.0.20-1.el7 will be installed
--> Processing Dependency: mysql-community-libs(x86-64) >= 8.0.11 for package: mysql-community-client-8.0.20-1.el7.x86_64
---> Package mysql-community-common.x86_64 0:8.0.20-1.el7 will be installed
--> Running transaction check
---> Package mariadb-libs.x86_64 1:5.5.65-1.el7 will be obsoleted
--> Processing Dependency: libmysqlclient.so.18()(64bit) for package: 2:postfix-2.10.1-9.el7.x86_64
--> Processing Dependency: libmysqlclient.so.18(libmysqlclient_18)(64bit) for package: 2:postfix-2.10.1-9.el7.x86_64
---> Package mysql-community-libs.x86_64 0:8.0.20-1.el7 will be obsoleting
--> Running transaction check
---> Package mysql-community-libs-compat.x86_64 0:8.0.20-1.el7 will be obsoleting
--> Finished Dependency Resolution

Dependencies Resolved

===============================================================================================
 Package       Arch  Version    Repository    Size
===============================================================================================
Installing:
 mysql-community-libs    x86_64  8.0.20-1.el7  mysql80-community  4.5 M
  replacing mariadb-libs.x86_64 1:5.5.65-1.el7
 mysql-community-libs-compat  x86_64  8.0.20-1.el7  mysql80-community  1.2 M
  replacing mariadb-libs.x86_64 1:5.5.65-1.el7
 mysql-community-server   x86_64  8.0.20-1.el7  mysql80-community  488 M
Installing for dependencies:
 mysql-community-client   x86_64  8.0.20-1.el7  mysql80-community  47 M
 mysql-community-common   x86_64  8.0.20-1.el7  mysql80-community  609 k

Transaction Summary
===============================================================================================
Install 3 Packages (+2 Dependent packages)

Total download size: 541 M
Is this ok [y/d/N]: y
Downloading packages:
warning: /var/cache/yum/x86_64/7/mysql80-community/packages/mysql-community-common-8.0.20-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Public key for mysql-community-common-8.0.20-1.el7.x86_64.rpm is not installed
(1/5): mysql-community-common-8.0.20-1.el7.x86_64.rpm     | 609 kB 00:00:00
(2/5): mysql-community-libs-8.0.20-1.el7.x86_64.rpm      | 4.5 MB 00:00:13
(3/5): mysql-community-libs-compat-8.0.20-1.el7.x86_64.rpm    | 1.2 MB 00:00:04
mysql-community-client-8.0.20- FAILED           B 00:22:23 ETA
http://repo.mysql.com/yum/mysql-8.0-community/el/7/x86_64/mysql-community-client-8.0.20-1.el7.x86_64.rpm: [Errno 12] Timeout on http://repo.mysql.com/yum/mysql-8.0-community/el/7/x86_64/mysql-community-client-8.0.20-1.el7.x86_64.rpm: (28, 'Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds')
Trying other mirror.
(4/5): mysql-community-server-8.0.20-1.el7.x86_64.rpm     | 488 MB 00:22:18
(5/5): mysql-community-client-8.0.20-1.el7.x86_64.rpm     | 47 MB 00:01:57
-----------------------------------------------------------------------------------------------
Total               376 kB/s | 541 MB 00:24:34
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Importing GPG key 0x5072E1F5:
 Userid  : "MySQL Release Engineering <mysql-build@oss.oracle.com>"
 Fingerprint: a4a9 4068 76fc bd3c 4567 70c8 8c71 8d3b 5072 e1f5
 Package : mysql80-community-release-el7-3.noarch (installed)
 From  : /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
 Installing : mysql-community-common-8.0.20-1.el7.x86_64         1/6
 Installing : mysql-community-libs-8.0.20-1.el7.x86_64         2/6
 Installing : mysql-community-client-8.0.20-1.el7.x86_64         3/6
 Installing : mysql-community-server-8.0.20-1.el7.x86_64         4/6
 Installing : mysql-community-libs-compat-8.0.20-1.el7.x86_64        5/6
 Erasing : 1:mariadb-libs-5.5.65-1.el7.x86_64           6/6
 Verifying : mysql-community-libs-compat-8.0.20-1.el7.x86_64        1/6
 Verifying : mysql-community-common-8.0.20-1.el7.x86_64         2/6
 Verifying : mysql-community-server-8.0.20-1.el7.x86_64         3/6
 Verifying : mysql-community-client-8.0.20-1.el7.x86_64         4/6
 Verifying : mysql-community-libs-8.0.20-1.el7.x86_64         5/6
 Verifying : 1:mariadb-libs-5.5.65-1.el7.x86_64           6/6 

Installed:
 mysql-community-libs.x86_64 0:8.0.20-1.el7
 mysql-community-libs-compat.x86_64 0:8.0.20-1.el7
 mysql-community-server.x86_64 0:8.0.20-1.el7             

Dependency Installed:
 mysql-community-client.x86_64 0:8.0.20-1.el7 mysql-community-common.x86_64 0:8.0.20-1.el7 

Replaced:
 mariadb-libs.x86_64 1:5.5.65-1.el7 

Complete!

安装完成后就会覆盖掉之前的mariadb

二、配置Mysql数据库

启动MySQL

systemctl start mysqld.service

查看MySQL运行状态

systemctl status mysqld.service
● mysqld.service - MySQL Server
 Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
 Active: active (running) since Wed 2020-05-13 23:57:41 HKT; 18s ago
  Docs: man:mysqld(8)
   http://dev.mysql.com/doc/refman/en/using-systemd.html
 Process: 9563 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
 Main PID: 9649 (mysqld)
 Status: "Server is operational"
 Tasks: 39
 CGroup: /system.slice/mysqld.service
   └─9649 /usr/sbin/mysqld

May 13 23:57:34 CentOS.highning.com systemd[1]: Starting MySQL Server...
May 13 23:57:41 CentOS.highning.com systemd[1]: Started MySQL Server.

找出root初始密码

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

2020-05-13T15:57:37.815353Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: 9*CxxNRWHqmL

进入数据库:

mysql -uroot -p

输入密码(密码是上面查询到的 ,/wsw6gif;eH ),此时不能操作数据库,必须修改密码之后才能操作数据库

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

其中‘new password'替换成你要设置的密码,注意:密码设置必须要大小写字母数字和特殊符号(,/';:等),不然不能配置成功

三、开启mysql的远程访问

执行以下命令开启远程访问限制(注意:下面命令开启的IP是 192.168.0.1,如要开启所有的,用%代替IP),mysql8.0和以前的版本不一样,不能用原来的命令同时授权和创建用户:

create user 'root'@'192.168.0.1' identified by 'password';
grant all privileges on *.* to 'root'@'192.168.0.1' with grant option;

再输入以下两行命令

flush privileges;
exit

四、为firewalld添加开放端口

添加mysql端口3306和Tomcat端口8080

firewall-cmd --zone=public --add-port=3306/tcp --permanent

firewall-cmd --zone=public --add-port=8080/tcp --permanent

重新载入

firewall-cmd --reload

最后在windows下用mysql命令登录

Microsoft Windows [版本 10.0.18363.778]
(c) 2019 Microsoft Corporation。保留所有权利。

C:\Users\highning>mysql -h 192.168.88.88 -P 3306 -u root -p
Enter password: ********
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 8.0.20 MySQL Community Server - GPL

Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
+--------------------+
| Database   |
+--------------------+
| information_schema |
| mysql    |
| performance_schema |
| sys    |
+--------------------+
4 rows in set (0.00 sec)

mysql>

修改密码安全策略,改为LOW,密码长度最小6位

mysql> SHOW VARIABLES LIKE 'validate_password%';
+--------------------------------------+--------+
| Variable_name      | Value |
+--------------------------------------+--------+
| validate_password.check_user_name | ON  |
| validate_password.dictionary_file |  |
| validate_password.length    | 8  |
| validate_password.mixed_case_count | 1  |
| validate_password.number_count  | 1  |
| validate_password.policy    | MEDIUM |
| validate_password.special_char_count | 1  |
+--------------------------------------+--------+
7 rows in set (0.00 sec)

mysql> set global validate_password.policy=LOW;
Query OK, 0 rows affected (0.00 sec)

mysql> set global validate_password.length=6;
Query OK, 0 rows affected (0.00 sec)

mysql> SHOW VARIABLES LIKE 'validate_password%';
+--------------------------------------+-------+
| Variable_name      | Value |
+--------------------------------------+-------+
| validate_password.check_user_name | ON |
| validate_password.dictionary_file |  |
| validate_password.length    | 6  |
| validate_password.mixed_case_count | 1  |
| validate_password.number_count  | 1  |
| validate_password.policy    | LOW |
| validate_password.special_char_count | 1  |
+--------------------------------------+-------+
7 rows in set (0.00 sec)

关于 mysql 密码策略相关参数;

1)、validate_password.length  固定密码的总长度;

2)、validate_password_dictionary_file 指定密码验证的文件路径;

3)、validate_password_mixed_case_count  整个密码中至少要包含大/小写字母的总个数;

4)、validate_password_number_count  整个密码中至少要包含阿拉伯数字的个数;

5)、validate_password.policy 指定密码的强度验证等级,默认为 MEDIUM;

6)、validate_password_special_char_count 整个密码中至少要包含特殊字符的个数;

关于 validate_password.policy 的取值:

LOW:只验证长度;

MEDIUM:验证长度、数字、大小写、特殊字符;

STRONG:验证长度、数字、大小写、特殊字符、字典文件;

总结

到此这篇关于CentOS7.8安装mysql 8.0.20的文章就介绍到这了,更多相关CentOS7.8安装mysql 8.0.20内容请搜索我们以前的文章或继续浏览下面的相关文章希望大家以后多多支持我们!

(0)

相关推荐

  • CentOS7版本安装Mysql8.0.20版本数据库的详细教程

    相关阅读: MySQL8.0.20安装教程及其安装问题详细教程  https://www.jb51.net/article/186202.htm mysql8.0.20下载安装及遇到的问题(图文详解)  https://www.jb51.net/article/186208.htm CentOS7安装Mysql8.0.20步骤: https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-20.html 官网下载有时速度比较慢,直接点击链接也

  • 基于centos7快速安装mysql5.7教程解析

    一. wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm 二. yum -y localinstall mysql57-community-release-el7-11.noarch.rpm 三. yum -y install mysql-community-server 四. systemctl start mysqld<br>ps -ef | grep mysql 五.mysql默认密码 ca

  • CentOS7.5 安装 Mysql8.0.19的教程图文详解

    一.前言 此篇文章安装mysql部分没有截图,适合有一定基础的同学. 安装方法是通过mysql官网下载的tar文件,解压后安装rpm文件. 因为公司网络慢,使用yum方法安装时,文件经常下载一半就不行了,所以使用这种方法.只要tar文件在,拷到哪安装都可以(网速好的同学请忽略). 二.安装文件下载 打开地址:https://www.mysql.com,点击红框链接: 页面拉到最后,点击红框链接: 在打开的页面,点击红框链接: 在打开的页面这样选择(CentOS 是基于红帽的,所以这样选择),然后

  • MySQL5.6.40在CentOS7 64下安装过程详解

    MySQL5.6.40在CentOS7 64下安装过程 1)卸载之前安装的mysql rm -rf /usr/local/mysql rm -rf /etc/init.d/mysqld 2)删除数据库目录 rm -rf /data/mysql/ 3)卸载以后安装依赖包,避免安装过程中出现问题 yum -y install wget vim bash-completion yum -y install gcc gcc-c++ cmake ncurses-devel autoconf perl pe

  • Centos7 mysql数据库安装及配置实现教程

    一.系统环境 yum update升级以后的系统版本为 [root@yl-web yl]# cat /etc/redhat-release CentOS Linux release 7.1.1503 (Core) 二.mysql安装 一般网上给出的资料都是 #yum install mysql #yum install mysql-server #yum install mysql-devel 安装mysql和mysql-devel都成功,但是安装mysql-server失败,如下: [root

  • CentOS8部署LNMP环境之编译安装mysql8.0.29的教程详解

    一.前提 由于我安装了几次,我就不再讲述报错了,有点打脑壳!!!提前把相关依赖和报错就地解决. 1.所需源码包 mysql-8.0.19.tar.gz boost_1_70_0.tar.gz //安装mysql-8所需要的boost版本 rpcsvc-proto-1.4.tar.gz //后面出错所需要的源码包 mysql-8.0.19下载地址:http://mirrors.sohu.com/mysql/ boost_1_70_0下载地址:https://dl.bintray.com/boost

  • VMware中安装CentOS7(设置静态IP地址)并通过docker容器安装mySql数据库(超详细教程)

    一位读大二的学弟问我怎么安装配置这些,我简单的整了一个教程,这里记录一下,并分享给需要的朋 安装过程学习使用足够,实际工作中有些繁琐的配置略过了! 打开VM虚拟机,菜单栏[文件]-->选择[新建虚拟机],选择"o自定义(高级)"-->[下一步] 默认一直点[下一步]到选择安装盘的位置,选择自己已经下载好的官方DVD镜像文件(不要整别的镜像,避免走不必要 的坑) [下一步]设置虚拟机名称(取一个合适的名称,设置合适的路径) 处理器设置默认,安装好虚拟centos后可以根据情况

  • CentOS7.8安装mysql 8.0.20的教程详解

    一.安装mysql软件 下载并安装MySQL官方的 Yum Repository,Mysql版本8.0.20 wget -i -c http://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm 下载后直接yum安装 yum -y install mysql80-community-release-el7-3.noarch.rpm 安装MySQL服务器 yum -y install mysql-community-serve

  • centOS7.4 安装 mysql 5.7.26的教程详解

    CentOS中默认安装有MariaDB,这个是MySQL的分支,但为了需要,还是要在系统中安装MySQL,而且安装完成之后可以直接覆盖掉MariaDB. 1 下载并安装MySQL官方的 Yum Repository [root@localhost ~]# wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm 使用上面的命令就直接下载了安装用的Yum Repository,大概25KB的样子,

  • Linux下安装mysql-8.0.20的教程详解

    ** Linux下安装mysql-8.0.20 ** 环境介绍 操作系统:CentOS 7 mysql下载地址:https://dev.mysql.com/downloads/mysql/ 下载版本:https://www.jb51.net/softs/609101.html https://www.jb51.net/softs/609101.html 卸载mysql 查看是否安装过mysql,命令:find / -name mysql 如果安装过,进行卸载: 删除相关目录: 删除配置文件: 删

  • win10 安装mysql 8.0.18-winx64的步骤详解

    1.先去官网下载mysql 安装包 https://dev.mysql.com/downloads/mysql/ 2.下载完后解压到你想要安装MSQ 的文件目录下(如 D:\Mysql) 3.管理员命令运行 命令行,进入mysql 安装包的 bin 目录(D:\MySQL\mysql-8.0.18-winx64\bin) 4.执行 命令 mysqld --initialize --console (会自动生成data 文件夹,且生成临时密码,记住临时密码) 5.执行命令mysqld --inst

  • 使用YUM在Linux(CentOS 7)下安装mysql 5.7.18的教程详解

    项目需要使用MySQL,由于以前都是在windows下傻瓜式安装,基本没有遇到什么问题,但是这次是在服务器上安装,由于到Linux上安装软件不熟悉,走了不少弯路,耽误了好多时间.总结下来,以免下次再走弯路. ****************************图片插入不成功,不知道是怎么回事********************************* 一.各种环境: linux版本:CentOS Linux release 7.2.1511 (core) mysql版本:communi

  • CentOS8.2安装Java 14.0.2的教程详解

    Java是一种安全,稳定且广为人知的通用编程语言和计算技术平台,具有许多相互关联的功能. 要运行基于Java的应用程序,必须在服务器上安装Java.您通常需要Java Runtime Environment(JRE),这是用于在Linux机器上运行Java应用程序的软件组件的集合. 如果要开发Java的软件应用程序,则需要安装Oracle Java开发工具包(JDK),该工具包带有一个完整的JRE软件包,其中包含用于开发,调试和监视Java应用程序的工具,它是Oracle支持的Java SE(标

  • Linux(CentOS7)使用 RPM 安装 mysql 8.0.11的教程

    一.安装准备工作 1.查看 Linux 相关信息(Linux 命令行操作) (1)查看 Linux 版本,用于下载对应的 mysql. [查看 Linux 信息:] uname -a (2)检查是否已经安装过 mysql. [检查 mysql 是否被安装]  rpm -qa | grep -i mysql 若安装过,会输出相关包名 [若有安装过 mysql,则删除相关文件]  rpm -e [--nodeps] 包名(此处包名是上面命令查出来的名字) 2.下载 mysql (1)官网地址 [官网

  • RedHat6.5/CentOS6.5安装Mysql5.7.20的教程详解

    下载rpm安装包 Mysql官网:https://dev.mysql.com/downloads/mysql/ 选择版本下载: 可以使用wget命令下载: [root@localhost opt]#wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.20-1.el6.x86_64.rpm-bundle.tar 注意RedHat的版本和系统位数. 查看依赖的库 [root@localhost opt]# yum search liba

  • win10安装zip版MySQL8.0.19的教程详解

    一. 下载后解压到想安装的目录 下载地址: https://dev.mysql.com/downloads/mysql/ 二. 在安装目录中添加配置文件my.ini [mysqld] # 设置3306端口 port=3306 # 设置mysql的安装目录 basedir=D:\DevTool\MySQL-8.0.19 # 设置mysql数据库的数据的存放目录 datadir=D:\DevTool\MySQL-8.0.19\data # 允许最大连接数 max_connections=200 #

  • windows版本下mysql的安装启动和基础配置图文教程详解

    下载: 第一步 : 打开网址(进入官网下载) :https://www.mysql.com ,点击downloads之后跳转到https://www.mysql.com/downloads 第二步 :跳转至网址https://dev.mysql.com/downloads/,选择Community选项 第三步 :点击MySQL Community Server进入https://dev.mysql.com/downloads/mysql/页面,再点击5.6版本的数据库 第四步:windows操作

随机推荐