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

 更新时间:2020年5月15日 16:48  点击:1536

相关阅读:

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数据库内容请搜索猪先飞以前的文章或继续浏览下面的相关文章希望大家以后多多支持猪先飞!

[!--infotagslink--]

相关文章

  • PHP7快速编译安装的步骤

    编译安装非常的简单了我们现在的php版本已经到了php7了,下文小编来为各位介绍一篇关于PHP7快速编译安装的步骤,希望文章能够帮助到各位。 一、安装必要一些依赖 yum...2016-11-25
  • Rstudio中安装package出现的问题及解决

    这篇文章主要介绍了Rstudio中安装package出现的问题及解决方案,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧...2021-05-06
  • PHP编译安装后PHP-FPM使用笔记

    PHP-FPM我们相信各位用高版本的php经常使用到了,下面整理了一些关于PHP-FPM的笔记,有兴趣的可进来看看。 今天赶上了123System OPenVZ VPS全场半价的机会,购入了一...2016-11-25
  • 安装和使用percona-toolkit来辅助操作MySQL的基本教程

    一、percona-toolkit简介 percona-toolkit是一组高级命令行工具的集合,用来执行各种通过手工执行非常复杂和麻烦的mysql和系统任务,这些任务包括: 检查master和slave数据的一致性 有效地对记录进行归档 查找重复的索...2015-11-24
  • Linux安装Pytorch1.8GPU(CUDA11.1)的实现

    这篇文章主要介绍了Linux安装Pytorch1.8GPU(CUDA11.1)的实现,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧...2021-03-25
  • vscode安装git及项目开发过程

    这篇文章主要介绍了vscode安装git及项目开发过程,本文通过图文并茂的形式给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下...2021-05-19
  • Visual Studio 2015下载和安装图文教程

    这篇文章主要为大家详细介绍了Visual Studio 2015下载和安装图文教程,具有一定的参考价值,感兴趣的小伙伴们可以参考一下...2021-09-22
  • Node调试工具JSHint的安装及配置教程

    现在我们介绍一种在Node下检查简单错误的JS代码验证工具JSHint。  JSHint的具体介绍参考http://www.jshint.com/about/,说直白点儿,JSHint就是一个检查JS代码规范与否的工具,它可以用来检查任何(包括server端和client端...2014-05-31
  • Centos中彻底删除Mysql(rpm、yum安装的情况)

    我用的centos6,mysql让我整出了各种问题,我想重装一个全新的mysql,yum remove mysql-server mysql之后再install并不能得到一个干净的mysql,原来的/etc/my.cnf依然没变,datadir里面的数据已没有任何变化,手动删除/etc/my.cn...2015-03-15
  • 在PyCharm中安装PaddlePaddle的方法

    这篇文章主要介绍了在PyCharm中安装PaddlePaddle的方法,本文给大家介绍的非常想详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下...2021-02-05
  • Ubuntu20.04安装cuda10.1的步骤(图文教程)

    这篇文章主要介绍了Ubuntu20.04安装cuda10.1的步骤(图文教程),文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧...2020-07-30
  • linux服务器快速卸载安装node环境(简单上手)

    这篇文章主要介绍了linux服务器快速卸载安装node环境(简单上手),文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧...2021-02-22
  • Postman安装与使用详细教程 附postman离线安装包

    这篇文章主要介绍了Postman安装与使用详细教程 附postman离线安装包,本文给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下...2021-03-05
  • uni-app从安装到卸载的入门教程

    这篇文章主要介绍了uni-app从安装到卸载的入门教程,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧...2020-05-15
  • vs2019安装和使用详细图文教程

    这篇文章主要介绍了vs2019安装和使用详细图文教程,本文通过图文并茂的形式给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下...2020-06-25
  • RHEL6.5编译安装MySQL5.6.26教程

    一、准备编译环境,安装所需依赖包yum groupinstall 'Development' -y yum install openssl openssl-devel zlib zlib-devel -y yum install readline-devel pcre-devel ncurses-devel bison-devel cmake -y二、编译安...2015-10-21
  • tomcat9 下载安装和配置+整合到eclipse的教程详解

    这篇文章主要介绍了tomcat9 下载安装和配置+整合到eclipse,本文通过图文并茂的形式给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下...2020-07-28
  • win2003 安装软件之PHP5 图文安装教程

    本教程共分八篇:系统安装与设置篇、软件安装与设置篇、文件及文件夹权限篇、系统服务篇、安全策略篇、系统组件篇、注册表篇、软件安全篇。本篇讨论的是第二篇软件安装与设置篇的第七部分:安装软件之PHP 5 安装图解。 ...2016-01-27
  • mac系统OS X10.10版本安装最新5.7.9mysql的方法

    用过mac的朋友都反映很好用,不仅美观,性能好,关键是他的系统底层对于开发人员来说,无疑就是一个最大的好处,用习惯linux的人就知道mac的强大。但是也有一点最蛋疼的是,mac的习惯跟windows两个概念,习惯了windows,难免会有点不...2015-10-30
  • 详解Windows下安装Nodejs步骤

    本篇文章主要介绍了详解Windows下安装Nodejs步骤,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧 ...2017-05-22