MySQL-8.0版本安装

版权声明:版权来自翻版 https://blog.csdn.net/weixin_44455125/article/details/89705337

下载mysql的RPM包

官网: https://dev.mysql.com
在这里插入图片描述
在这里插入图片描述
#下载了CentOS(红帽版本的RPM包)
#下载之后上传至/server/tools下
#下载rz命令直接拖拽

yum install lrzsz -y

安装

解压tar包
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
#看的官方文档使用的翻译
安装命令

sudo yum install mysql-community-{server,client,common,libs}-*

#虽然使用像yum这样的高级包管理工具来安装包要好得多,但是喜欢直接rpm命令的用户可以用rpm -Uvh命令替换yum install命令;然而,使用rpm -Uvh会使安装过程更容易失败,因为安装过程可能会遇到潜在的依赖关系问题(来自官方文档)
在这里插入图片描述
在这里插入图片描述

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述

安装过程

[root@LIU /]# wget https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-8.0.16-2.el7.x86_64.rpm-bundle.tar
--2019-05-08 19:33:25--  https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-8.0.16-2.el7.x86_64.rpm-bundle.tar
Resolving cdn.mysql.com (cdn.mysql.com)... 104.127.195.16
Connecting to cdn.mysql.com (cdn.mysql.com)|104.127.195.16|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 607068160 (579M) [application/x-tar]
Saving to: ‘mysql-8.0.16-2.el7.x86_64.rpm-bundle.tar’

100%[===========================================================>] 607,068,160 3.29MB/s   in 3m 2s  

2019-05-08 19:36:28 (3.17 MB/s) - ‘mysql-8.0.16-2.el7.x86_64.rpm-bundle.tar’ saved [607068160/607068160]
[root@LIU tools]# ls
mysql-8.0.16-2.el7.x86_64.rpm-bundle.tar
mysql-community-client-8.0.16-2.el7.x86_64.rpm
mysql-community-common-8.0.16-2.el7.x86_64.rpm
mysql-community-devel-8.0.16-2.el7.x86_64.rpm
mysql-community-embedded-compat-8.0.16-2.el7.x86_64.rpm
mysql-community-libs-8.0.16-2.el7.x86_64.rpm
mysql-community-libs-compat-8.0.16-2.el7.x86_64.rpm
mysql-community-server-8.0.16-2.el7.x86_64.rpm
mysql-community-test-8.0.16-2.el7.x86_64.rpm
[root@LIU tools]# yum install mysql-community-{server,client,common,libs}-*
Loaded plugins: fastestmirror
Examining mysql-community-server-8.0.16-2.el7.x86_64.rpm: mysql-community-server-8.0.16-2.el7.x86_64
Marking mysql-community-server-8.0.16-2.el7.x86_64.rpm to be installed
Examining mysql-community-client-8.0.16-2.el7.x86_64.rpm: mysql-community-client-8.0.16-2.el7.x86_64
Marking mysql-community-client-8.0.16-2.el7.x86_64.rpm to be installed
Examining mysql-community-common-8.0.16-2.el7.x86_64.rpm: mysql-community-common-8.0.16-2.el7.x86_64
Marking mysql-community-common-8.0.16-2.el7.x86_64.rpm to be installed
Examining mysql-community-libs-8.0.16-2.el7.x86_64.rpm: mysql-community-libs-8.0.16-2.el7.x86_64
Marking mysql-community-libs-8.0.16-2.el7.x86_64.rpm to be installed
Examining mysql-community-libs-compat-8.0.16-2.el7.x86_64.rpm: mysql-community-libs-compat-8.0.16-2.el7.x86_64
Marking mysql-community-libs-compat-8.0.16-2.el7.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package mariadb-libs.x86_64 1:5.5.60-1.el7_5 will be obsoleted
---> Package mysql-community-client.x86_64 0:8.0.16-2.el7 will be installed
---> Package mysql-community-common.x86_64 0:8.0.16-2.el7 will be installed
---> Package mysql-community-libs.x86_64 0:8.0.16-2.el7 will be obsoleting
---> Package mysql-community-libs-compat.x86_64 0:8.0.16-2.el7 will be obsoleting
---> Package mysql-community-server.x86_64 0:8.0.16-2.el7 will be installed
--> Processing Dependency: libaio.so.1(LIBAIO_0.1)(64bit) for package: mysql-community-server-8.0.16-2.el7.x86_64
Loading mirror speeds from cached hostfile
 * base: mirrors.cloud.aliyuncs.com
 * extras: mirrors.cloud.aliyuncs.com
 * updates: mirrors.cloud.aliyuncs.com
--> Processing Dependency: libaio.so.1(LIBAIO_0.4)(64bit) for package: mysql-community-server-8.0.16-2.el7.x86_64
--> Processing Dependency: libaio.so.1()(64bit) for package: mysql-community-server-8.0.16-2.el7.x86_64
--> Running transaction check
---> Package libaio.x86_64 0:0.3.109-13.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=====================================================================================================
 Package                Arch   Version        Repository                                        Size
=====================================================================================================
Installing:
 mysql-community-client x86_64 8.0.16-2.el7   /mysql-community-client-8.0.16-2.el7.x86_64      143 M
 mysql-community-common x86_64 8.0.16-2.el7   /mysql-community-common-8.0.16-2.el7.x86_64      8.0 M
 mysql-community-libs   x86_64 8.0.16-2.el7   /mysql-community-libs-8.0.16-2.el7.x86_64         14 M
     replacing  mariadb-libs.x86_64 1:5.5.60-1.el7_5
 mysql-community-libs-compat
                        x86_64 8.0.16-2.el7   /mysql-community-libs-compat-8.0.16-2.el7.x86_64 9.5 M
     replacing  mariadb-libs.x86_64 1:5.5.60-1.el7_5
 mysql-community-server x86_64 8.0.16-2.el7   /mysql-community-server-8.0.16-2.el7.x86_64      1.8 G
Installing for dependencies:
 libaio                 x86_64 0.3.109-13.el7 base                                              24 k

Transaction Summary
=====================================================================================================
Install  5 Packages (+1 Dependent package)

Total size: 1.9 G
Total download size: 24 k
Is this ok [y/d/N]: y
Downloading packages:
libaio-0.3.109-13.el7.x86_64.rpm                                              |  24 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : mysql-community-common-8.0.16-2.el7.x86_64                                        1/7 
  Installing : mysql-community-libs-8.0.16-2.el7.x86_64                                          2/7 
  Installing : mysql-community-client-8.0.16-2.el7.x86_64                                        3/7 
  Installing : libaio-0.3.109-13.el7.x86_64                                                      4/7 
  Installing : mysql-community-server-8.0.16-2.el7.x86_64                                        5/7 
  Installing : mysql-community-libs-compat-8.0.16-2.el7.x86_64                                   6/7 
  Erasing    : 1:mariadb-libs-5.5.60-1.el7_5.x86_64                                              7/7 
  Verifying  : mysql-community-libs-8.0.16-2.el7.x86_64                                          1/7 
  Verifying  : mysql-community-libs-compat-8.0.16-2.el7.x86_64                                   2/7 
  Verifying  : mysql-community-client-8.0.16-2.el7.x86_64                                        3/7 
  Verifying  : mysql-community-common-8.0.16-2.el7.x86_64                                        4/7 
  Verifying  : mysql-community-server-8.0.16-2.el7.x86_64                                        5/7 
  Verifying  : libaio-0.3.109-13.el7.x86_64                                                      6/7 
  Verifying  : 1:mariadb-libs-5.5.60-1.el7_5.x86_64                                              7/7 

Installed:
  mysql-community-client.x86_64 0:8.0.16-2.el7   mysql-community-common.x86_64 0:8.0.16-2.el7       
  mysql-community-libs.x86_64 0:8.0.16-2.el7     mysql-community-libs-compat.x86_64 0:8.0.16-2.el7  
  mysql-community-server.x86_64 0:8.0.16-2.el7  

Dependency Installed:
  libaio.x86_64 0:0.3.109-13.el7                                                                     

Replaced:
  mariadb-libs.x86_64 1:5.5.60-1.el7_5                                                               

Complete!
[root@LIU tools]#
[root@LIU tools]# systemctl start mysqld
[root@LIU tools]# grep 'temporary password' /var/log/mysqld.log 
2019-05-08T11:46:36.517401Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: /Ga!#!:ju3/9
[root@LIU tools]# 
[root@LIU tools]# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 8.0.16

Copyright (c) 2000, 2019, 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> 
mysql> alter user 'root'@'localhost' identified by 'MyNewPass4!';
Query OK, 0 rows affected (0.01 sec)

mysql> 
mysql> ^DBye
[root@LIU tools]# vim /etc/my.cnf
#For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/8.0/en/server-configuration-defaults.html

[mysqld]
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove the leading "# " to disable binary logging
# Binary logging captures changes between backups and is enabled by
# default. It's default setting is log_bin=binlog
# disable_log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
#
# Remove leading # to revert to previous value for default_authentication_plugin,
# this will increase compatibility with older clients. For background, see:
# https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_default_authentication_plugin
# default-authentication-plugin=mysql_native_password

datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock

log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
[mysql]
user=root
password=MyNewPass4!

[root@LIU tools]# systemctl restart mysqld
[root@LIU tools]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.16 MySQL Community Server - GPL

Copyright (c) 2000, 2019, 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>

猜你喜欢

转载自blog.csdn.net/weixin_44455125/article/details/89705337