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

官网下载有时速度比较慢,直接点击链接也可以下载:mysql 8.0.20

官网下载8.0.20Mysql包(bundle版本)

1.创建mysql文件夹:

[root@localhost ~]# mkdir /usr/local/mysql
[root@localhost ~]# cd /usr/local/mysql/

将下载的mysql包放在创建的MySQL文件夹内:

[root@localhost mysql]# ll
总用量 815000
-rw-r--r--. 1 root root 834560000 5月 13 10:44 mysql-8.0.20-1.el7.x86_64.rpm-bundle.tar

mysql的安装版MD5码查看是否和官网上的相对应:

[root@localhost mysql]# md5sum mysql-8.0.20-1.el7.x86_64.rpm-bundle.tar
c8d062c1f74d9aab7dbdd5300b202b6e mysql-8.0.20-1.el7.x86_64.rpm-bundle.tar

将mysql的包解压得到几个内安装包:

[root@localhost mysql]# tar -xvf mysql-8.0.20-1.el7.x86_64.rpm-bundle.tar
mysql-community-libs-8.0.20-1.el7.x86_64.rpm
mysql-community-embedded-compat-8.0.20-1.el7.x86_64.rpm
mysql-community-test-8.0.20-1.el7.x86_64.rpm
mysql-community-common-8.0.20-1.el7.x86_64.rpm
mysql-community-devel-8.0.20-1.el7.x86_64.rpm
mysql-community-client-8.0.20-1.el7.x86_64.rpm
mysql-community-libs-compat-8.0.20-1.el7.x86_64.rpm
mysql-community-server-8.0.20-1.el7.x86_64.rpm
[root@localhost mysql]# ll
总用量 1630004
-rw-r--r--. 1 root root 834560000 5月 13 10:44 mysql-8.0.20-1.el7.x86_64.rpm-bundle.tar
-rw-r--r--. 1 7155 31415 48822048 3月 27 20:14 mysql-community-client-8.0.20-1.el7.x86_64.rpm
-rw-r--r--. 1 7155 31415 623508 3月 27 20:14 mysql-community-common-8.0.20-1.el7.x86_64.rpm
-rw-r--r--. 1 7155 31415 8129988 3月 27 20:14 mysql-community-devel-8.0.20-1.el7.x86_64.rpm
-rw-r--r--. 1 7155 31415 23599996 3月 27 20:14 mysql-community-embedded-compat-8.0.20-1.el7.x86_64.rpm
-rw-r--r--. 1 7155 31415 4667884 3月 27 20:14 mysql-community-libs-8.0.20-1.el7.x86_64.rpm
-rw-r--r--. 1 7155 31415 1277128 3月 27 20:14 mysql-community-libs-compat-8.0.20-1.el7.x86_64.rpm
-rw-r--r--. 1 7155 31415 512057468 3月 27 20:15 mysql-community-server-8.0.20-1.el7.x86_64.rpm
-rw-r--r--. 1 7155 31415 235369940 3月 27 20:16 mysql-community-test-8.0.20-1.el7.x86_64.rpm

依次安装顺序时common,libs,libs-compat,client,server:

警告:mysql-community-common-8.0.20-1.el7.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID ********: NOKEY
准备中...  ################################# [100%]
正在升级/安装...
 1:mysql-community-common-8.0.20-1.e################################# [100%]
警告:mysql-community-libs-8.0.20-1.el7.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID ********: NOKEY
准备中...  ################################# [100%]
正在升级/安装...
 1:mysql-community-libs-8.0.20-1.el7################################# [100%]
警告:mysql-community-libs-compat-8.0.20-1.el7.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID ********: NOKEY
准备中...  ################################# [100%]
正在升级/安装...
 1:mysql-community-libs-compat-8.0.2################################# [100%]
警告:mysql-community-client-8.0.20-1.el7.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID ********: NOKEY
准备中...  ################################# [100%]
正在升级/安装...
 1:mysql-community-client-8.0.20-1.e################################# [100%]
警告:mysql-community-server-8.0.20-1.el7.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID ********: NOKEY
准备中...  ################################# [100%]
正在升级/安装...
 1:mysql-community-server-8.0.20-1.e################################# [100%]

编辑一下/etc/my.cnf文件:
在最下面增加一行:

lower_case_table_names=1

initialize初始化:

[root@localhost mysql]# mysqld --initialize
[root@localhost mysql]#

更改一下权限:

[root@localhost mysql]# chown -R mysql:mysql /var/lib/mysql
[root@localhost mysql]# ll /var/lib/
总用量 8
drwxr-xr-x. 4 root root 32 5月 13 10:07 AccountsService
drwxr-xr-x. 2 root root 6 8月 3 2017 alsa
drwxr-xr-x. 2 root root 274 5月 13 10:14 alternatives
drwx------. 3 root root 18 5月 13 10:17 authconfig
drwxr-xr-x. 2 root root 6 8月 3 2017 bluetooth
drwxr-xr-x. 2 chrony chrony 6 8月 4 2017 chrony
drwxr-xr-x. 3 root root 17 5月 13 10:06 color
drwxr-xr-x. 4 colord colord 67 5月 13 10:23 colord
drwxr-xr-x. 2 root root 6 11月 7 2016 dbus
drwxr-xr-x. 2 root root 6 8月 4 2017 dhclient
drwxr-xr-x. 2 root root 6 8月 3 2017 dnsmasq
drwxr-xr-x. 3 root root 34 5月 13 10:24 flatpak
drwxr-xr-x. 2 root root 6 6月 24 2014 fprint
drwxr-xr-x. 2 root root 6 11月 5 2016 games
drwxrwx--T. 5 gdm gdm 70 5月 13 10:23 gdm
drwxr-xr-x. 2 geoclue geoclue 6 8月 2 2017 geoclue
drwxr-xr-x. 4 root root 55 5月 13 02:22 gssproxy
drwxr-xr-x. 2 root root 6 8月 2 2017 hyperv
drwxr-xr-x. 2 root root 6 8月 5 2017 initramfs
drwxr-xr-x. 8 root root 90 5月 13 10:07 iscsi
drwxr-xr-x. 8 root root 93 5月 13 10:08 libvirt
drwxr-xr-x. 2 root root 6 11月 6 2016 lldpad
drwxr-xr-x. 2 root root 6 8月 2 2017 logrotate
drwx------. 2 root root 6 5月 13 10:06 machines
drwxr-xr-x. 2 root root 37 5月 13 02:22 misc
drwxr-x---. 2 root slocate 6 11月 5 2016 mlocate
drwxr-x--x. 6 mysql mysql 4096 5月 13 11:05 mysql

启动mysql服务看一下服务状态,看Active这一行的状态:

[root@localhost mysql]# systemctl start mysqld.service
[root@localhost 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 三 2020-05-13 11:09:35 CST; 8s ago
 Docs: man:mysqld(8)
 http://dev.mysql.com/doc/refman/en/using-systemd.html
 Process: 16795 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
 Main PID: 16829 (mysqld)
 Status: "Server is operational"
 CGroup: /system.slice/mysqld.service
 └─16829 /usr/sbin/mysqld

5月 13 11:09:24 localhost.localdomain systemd[1]: Starting MySQL Server...
5月 13 11:09:35 localhost.localdomain systemd[1]: Started MySQL Server.
[root@localhost mysql]#

查看数据库初始的密码:

[root@localhost mysql]# cat /var/log/mysqld.log | grep password
2020-05-13T03:05:16.041238Z 6 [Note] [MY-010454]
[Server] A temporary password is generated for root@localhost: n_t#tk.Z?7)f

使用初始密码登陆数据库:后更改密码:

[root@localhost mysql]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.20

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>
mysql> ALTER user 'root'@'localhost' identified with mysql_native_password by '123456';
Query OK, 0 rows affected (0.04 sec)

mysql> exit
Bye
[root@localhost mysql]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 9
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> SELECT VERSION;
ERROR 1054 (42S22): Unknown column 'VERSION' in 'field list'
mysql> SELECT VERSION();
+-----------+
| VERSION() |
+-----------+
| 8.0.20 |
+-----------+
1 row in set (0.00 sec)

mysql>

到此可以正常登陆数据库了,可以自行查找开启远程方式。

总结

到此这篇关于CentOS7版本安装Mysql8.0.20版本数据库的详细教程的文章就介绍到这了,更多相关CentOS7安装Mysql8.0数据库内容请搜索我们以前的文章或继续浏览下面的相关文章希望大家以后多多支持我们!

(0)

相关推荐

  • MySQL8.0.20安装教程及其安装问题详细教程

    官网下载MySQL的安装包 1.下载链接如下: MySQL8.0.20版本 https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-20.html 其他版本:MySQL8.0.16版本 2.MySQL8.0.20版本压缩包解压后如下图所示: 添加并配置my.ini文件 在原解压根目录下添加my.ini文件: 新建文本文件,也就是记事本文件,并命名为my.ini (也就是拓展名为ini格式).如果更改不了拓展名,点击前往了解查看解决方法.

  • 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

  • MySQL8.0.19安装教程

    官网下载安装包:mysql-8.0.19-linux-glibc2.12-x86_64.tar.xz 安装环境:CentOS Linux release 7.5.1804 (Core) 解压安装包: xz -d mysql-8.0.19-linux-glibc2.12-x86_64.tar.xz tar -xvf mysql-8.0.19-linux-glibc2.12-x86_64.tar 环境变量: yum install -y gcc gcc-c++ make cmake automake

  • mysql8.0.20下载安装及遇到的问题(图文详解)

    1.浏览器搜索mysql下载安装 地址:https://dev.mysql.com/downloads/mysql/ 2.登录或者不登录下载 3.下载的是一个压缩包,直接解压缩,无需安装 4.新建my.ini文件,内容如下 关于sql_mode,像下面这个报错,就是因为group by字段必须完全显示在查询列里,所以去掉这个模式,就不在报错了. Caused by: java.sql.SQLSyntaxErrorException: Expression #13 of SELECT list i

  • 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 官网下载有时速度比较慢,直接点击链接也

  • Windows安装MySQL8.0.x 版本教程

    目录 一.下载 二.安装 1 解压 2 配置环境变量 右击此电脑选择属性 双击系统环境变量的Path 3 配置my.ini 4 命令行启动mysql WIN+R 输入cmd 进入window命令行 cd 进入安装mysql的bin目录下 5 修改登录密码 一.下载 MySQL官网下载链接:https://downloads.mysql.com/archives/community/ 选择版本后下载zip文件 博主选择的是8.0.13 二.安装 1 解压 把下载好的zip包在你想要的路径下直接解压

  • 源码编译安装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 1 概述 本文章主要讲述

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

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

  • 阿里云centos7中安装MySQL8.0.13的方法步骤

    1.下载MySQL安装包 (这里是有技巧的,说不定我这时写这个的时候版本还是你看到时的旧版本了,如果已经不是8.0了,可以根据这样来 下新版本) 先进入官网 再将这两者一结合,就是最新版本的了 所以 [root@h1 ~]# rpm -ivh http://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm 2.安装mysql [root@localhost ~]# yum install -y mysql-server 或

  • Centos7下安装MySQL8.0.23的步骤(小白入门级别)

    首先简单介绍一下什么叫MySQL: 数据库简而言之就是存储数据的仓库,为了方便数据的存储和管理,它将数据按照特定的规律存储在磁盘上.是为了实现一定的目的,按照某种规则组织起来的数据的集合: MySQL是一种开放源代码的关系型数据库管理系统(RDBMS),使用最常用的数据库管理语言--结构化bai查询语言(SQL)进行数据库管理.通过数据库管理系统,可以有效的组织和管理存储在数据库中的数据. 那么我们常见的数据库模型: 1,关系型数据库 MySql Oracle SQL Server 2,非关系型

  • 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 如果安装过,进行卸载: 删除相关目录: 删除配置文件: 删

  • CentOS7.6安装MYSQL8.0的步骤详解

    1.一般CentOS默认安装了mariadb,所以先查看是否安装mariadb,如果安装就需要先卸载mariadb rpm -qa|grep mariadb rpm -e mariadb-libs --nodeps 2.在/usr/local/目录下创建mysql文件夹 cd /cd usr/localmkdir mysql 3.进入mysql文件夹内,下载mysql cd mysqlwget https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql

  • mysql8.0.20数据目录迁移的方法

    mysql的存储目录默认是在/var/lib/mysql/,下面将修改默认存储目录. 本文使用mysql8.0.20版本,与mysql8.0.11版本不同, 8.0.11版本的数据迁移请看另一篇博客:mysql8.0.11数据迁移 1.先停止mysql服务: service mysqld stop 2.创建需要存放的目录位置并赋予权限: mkdir -p /bak/mysql_data chmod 766 /bak/mysql_data 3.转移原有数据,这里使用 cp -a 进行复制(先进入到

随机推荐