【Centos】RPM安装Mysql8
先去官网下载RPM包,没想到RPM包是红帽发行版
https://dev.mysql.com/downloads/mysql/
使用wget直接下载到Centos里面:
wget https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-8.0.27-1.el7.x86_64.rpm-bundle.tar
解压Tar包:
[root@localhost ~]# tar -xvf mysql-8.0.27-1.el7.x86_64.rpm-bundle.tar
mysql-community-client-8.0.27-1.el7.x86_64.rpm
mysql-community-client-plugins-8.0.27-1.el7.x86_64.rpm
mysql-community-common-8.0.27-1.el7.x86_64.rpm
mysql-community-devel-8.0.27-1.el7.x86_64.rpm
mysql-community-embedded-compat-8.0.27-1.el7.x86_64.rpm
mysql-community-libs-8.0.27-1.el7.x86_64.rpm
mysql-community-libs-compat-8.0.27-1.el7.x86_64.rpm
mysql-community-server-8.0.27-1.el7.x86_64.rpm
mysql-community-test-8.0.27-1.el7.x86_64.rpm
[root@localhost ~]#
删除残留的MariaDB
[root@localhost ~]# rpm -qa|grep mariadb
mariadb-libs-5.5.68-1.el7.x86_64
[root@localhost ~]# rpm -e --nodeps mariadb-libs-5.5.68-1.el7.x86_64
[root@localhost ~]#
二次检查:
[root@localhost ~]# rpm -qa|grep mariadb
[root@localhost ~]#
开始安装:
rpm -ivh --nodeps --force mysql-community-common-8.0.27-1.el7.x86_64.rpm
rpm -ivh --nodeps --force mysql-community-libs-8.0.27-1.el7.x86_64.rpm
rpm -ivh --nodeps --force mysql-community-libs-compat-8.0.27-1.el7.x86_64.rpm
rpm -ivh --nodeps --force mysql-community-client-8.0.27-1.el7.x86_64.rpm
rpm -ivh --nodeps --force mysql-community-client-plugins-8.0.27-1.el7.x86_64.rpm
rpm -ivh --nodeps --force mysql-community-embedded-compat-8.0.27-1.el7.x86_64.rpm
rpm -ivh --nodeps --force mysql-community-server-8.0.27-1.el7.x86_64.rpm
查看我们安装的内容:
[root@localhost ~]# rpm -qa | grep mysql
mysql-community-libs-8.0.27-1.el7.x86_64
mysql-community-server-8.0.27-1.el7.x86_64
mysql-community-client-plugins-8.0.27-1.el7.x86_64
mysql-community-libs-compat-8.0.27-1.el7.x86_64
mysql-community-embedded-compat-8.0.27-1.el7.x86_64
mysql-community-common-8.0.27-1.el7.x86_64
mysql-community-client-8.0.27-1.el7.x86_64
[root@localhost ~]#
查看当前MySQL服务状态:
[root@localhost ~]# systemctl status mysqld
● mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: inactive (dead)
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
[root@localhost ~]#
不管MySQL是否运行还是不运行,都执行服务停止命令
[root@localhost ~]# service mysqld stop
Redirecting to /bin/systemctl stop mysqld.service
[root@localhost ~]#
执行初始化:
[root@localhost ~]# mysqld --initialize --console
[root@localhost ~]#
目录可写权限赋予:
[root@localhost ~]# chown -R mysql:mysql /var/lib/mysql/
[root@localhost ~]#
启动MySQL:
[root@localhost ~]# systemctl start mysqld
[root@localhost ~]#
查看服务状态:
[root@localhost ~]# systemctl status mysqld
● mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: active (running) since 日 2021-10-24 09:31:18 CST; 3s ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Process: 9201 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
Main PID: 9241 (mysqld)
Status: "Server is operational"
CGroup: /system.slice/mysqld.service
└─9241 /usr/sbin/mysqld 10月 24 09:31:04 localhost.localdomain systemd[1]: Starting MySQL Server...
10月 24 09:31:18 localhost.localdomain systemd[1]: Started MySQL Server.
[root@localhost ~]#
翻看日志文件,找到初始化的密码:
[root@localhost ~]# cat /var/log/mysqld.log
2021-10-24T01:29:47.674319Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.27) initializing of server in progress as process 8984
2021-10-24T01:29:47.888787Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-10-24T01:29:50.370284Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2021-10-24T01:29:54.018924Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1 is enabled for channel mysql_main
2021-10-24T01:29:54.022463Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1.1 is enabled for channel mysql_main
2021-10-24T01:29:54.293689Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: SoOu?/jep09>
2021-10-24T01:31:13.997176Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.27) starting as process 9241
2021-10-24T01:31:14.148958Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-10-24T01:31:15.775588Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2021-10-24T01:31:18.363257Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1 is enabled for channel mysql_main
2021-10-24T01:31:18.381048Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1.1 is enabled for channel mysql_main
2021-10-24T01:31:18.383717Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2021-10-24T01:31:18.383752Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2021-10-24T01:31:18.586545Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.27' socket: '/var/lib/mysql/mysql.sock' port: 3306 MySQL Community Server - GPL.
2021-10-24T01:31:18.586771Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock
[root@localhost ~]#
登陆MySQL,输入随机生成的密码:【SoOu?/jep09>】
[root@localhost ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.27 Copyright (c) 2000, 2021, Oracle and/or its affiliates. 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>
设置root用户密码永不过期:
ALTER USER 'root'@'localhost' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER;
更改root密码为123456:
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';
设置root账户允许被外部访问:
UPDATE mysql.`user` SET host = "%" WHERE user = "root";
刷新权限:
FLUSH PRIVILEGES;
退出:
QUIT;
防火墙拦截处理:
先查看防火墙状态:
[root@localhost ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: active (running) since 日 2021-10-24 09:55:25 CST; 5s ago
Docs: man:firewalld(1)
Main PID: 12734 (firewalld)
CGroup: /system.slice/firewalld.service
└─12734 /usr/bin/python2 -Es /usr/sbin/firewalld --nofork --nopid 10月 24 09:55:23 localhost.localdomain systemd[1]: Starting firewalld - dynamic firewall daemon...
10月 24 09:55:25 localhost.localdomain systemd[1]: Started firewalld - dynamic firewall daemon.
10月 24 09:55:26 localhost.localdomain firewalld[12734]: WARNING: AllowZoneDrifting is enabled. This is considered an insecure configuration option. It will be removed in a future release. Please consider disabling it now.
[root@localhost ~]#
防火墙开启,没开放端口,会被拦截下来:
查看开放的端口列表:
[root@localhost ~]# firewall-cmd --zone=public --list-ports [root@localhost ~]#
开放3306端口:
[root@localhost ~]# firewall-cmd --zone=public --add-port=3306/tcp --permanent
success
[root@localhost ~]#
重新加载防火墙:
[root@localhost ~]# firewall-cmd --reload
success
[root@localhost ~]#
【Centos】RPM安装Mysql8的更多相关文章
- Linux(CentOS7)下rpm安装MySQL8.0.16
记录一下自己在 CentOS7 下 rpm 安装 MySQL8.0.16 的过程. 一.准备工作 1. 下载MySQL所需要的安装包 从 MySQL官网 下载,上传至 CentOS 系统 /usr/l ...
- CentOS下安装MYSQL8.X并设置忽略大小写
安装 在官网上下载:mysql80-community-release-el7-2.noarch.rpm.安装方式与5.7基本相同.详细安装过程见:CentOS下安装mysql5.7和mysql8.x ...
- Centos 7 安装Mysql8 主从同步复制
环境:Centos 7 软件:Mysql8 安装方式:Yum 1.从官网下载最新yum 源对应Cenots 7 版本安装: [root@DataNode-03 ~]# yum -y localinst ...
- 【Linux系列】Centos 7安装 Mysql8.0(五)
目的 本文主要介绍以下两点: 一. 如何安装Mysql8.0 二. Navicat连接Mysql 一. 如何安装Mysql8.0 安装Mysql有两种方式: 直接下载官方的源(比较慢) https:/ ...
- CentOS 7 安装MySQL8
安装 下载Linux对应的MySQL https://dev.mysql.com/downloads/mysql/ CentOS选择Red Hat Enterprise Linux 在/usr/loc ...
- CentOS RPM安装MySQL-5.6
1.检查是否有安装 安装之前应该先查询系统是否自在了mysql的软件包 rpm -qa|grep -i mysql 如果有的话需要先删除 rpm -e 软件名 --nodeps 2.下载安装包 cd/ ...
- CentOS RPM 安装 MySQL5.7
环境 CentOS 7 64位 MySQL 5.7 64位 1.卸载系统自带的 mariadb [root@localhost /]# rpm -qa|grep mariadb mariadb-lib ...
- CentOS 7 安装 MySql8.0
1-配置 Yum 库 rpm -Uvh https://repo.mysql.com/mysql80-community-release-el7-3.noarch.rpm 2-安装 MySql 2.1 ...
- CentOS如何安装MySQL8.0、创建用户并授权的详细步骤
# 安装相关软件 yum install -y gcc gcc-c++ openssl openssl-devel ncurses ncurses-devel make cmake # 获取MySQL ...
- centos rpm安装jdk1.8
1.官网下载jdk的rpm文件(http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html) ...
随机推荐
- rhce练习题容易错的地方
rhce练习题里容易错的地方 使用导航器的时候,ssh连接 因为导航器是一个工具,生成一个容器,在容器里面运行playbook 安装软件包的时候,多个软件包使用循环loop loop的格式 - hos ...
- WIn32 C++ 消息处理函数 问题
这个消息处理这个 Winproc 这个 接收到网络信息 在自己的函数用完后可以选择向系统路由传递这个网络消息接收到的数据原型 你处理完,系统也处理,不想让系统处理可以不将接受到的那几个变量啊数据啊,就 ...
- mongodb QuickStart Demo
import com.mongodb.client.MongoClient; import com.mongodb.client.MongoClients; import com.mongodb.cl ...
- ES Elasticsearch exception [type=search_phase_execution_exception, reason=all shards failed
查看日志切分:sed -n '/2022-03-21 01:50:11.785/,/2022-03-21 02:25:01.130/p' test-2022-03-21-1.log > 2203 ...
- kafka事务流程
流程 kafka事务使用的5个API // 1. 初始化事务 void initTransactions(); // 2. 开启事务 void beginTransaction() throws Pr ...
- Luban小试牛刀
Luban小试牛刀 LubanUnity LubanUnity配置工具配置解决方案 简介 Github 文档 视频教程 Unity工具 个人感觉挺强大,便捷的,适合中大型游戏项目的配置工作.小 ...
- 机器学习(一)——递归特征消除法实现SVM(matlab)
机器学习方法对多维特征数据进行分类:本文用到非常经典的机器学习方法,使用递归特征消除进行特征选择,使用支持向量机构建分类模型,使用留一交叉验证的方法来评判模型的性能. 构建模型:支持向量机(Suppo ...
- Win10 下安装使用easyocr图片识别工具
[前言] 最近在做图像识别相关的工作,找到了一个名为EasyOCR的pythoh 库. 使用过程中出现了一些问题,现做简单记录. [正文] 1. 安装EasyOCR 我用了最简单的方法:pip3 in ...
- ubuntu18 编译安装gccxml
最近需要在ubuntu上安装gccxml,我的ubuntu版本是18. 使用sudo apt-get install gccxml提示找不到gccxml,最后使用了编译安装的方式安装gccxml. 1 ...
- Java使用不同方式优雅拆分业务逻辑
如何处理复杂的业务逻辑 在实际的业务开发当中,经常会遇到复杂的业务逻辑,可能实现出来的代码并没有什么问题,但是代码的可读性很差. 那么在实际开发中如何避免大面积的 if-else 代码块的问题? 补充 ...