码迷,mamicode.com
首页 > 数据库 > 详细

mysql8安装

时间:2020-02-27 16:11:37      阅读:101      评论:0      收藏:0      [点我收藏+]

标签:mbed   mkdir   ystemd   RoCE   tool   pass   pat   ble   cal   

安装

先去下载 https://dev.mysql.com/downloads/mysql/

技术图片

然后上传到Linux

进入存放目录,解压到指定目录【我这里是/soft/mysql8

技术图片
[root@localhost ~]# cd /soft/
[root@localhost soft]# mkdir mysql8
[root@localhost soft]# tar -xvf mysql-8.0.16-2.el7.x86_64.rpm-bundle.tar -C mysql8/
mysql-community-libs-8.0.16-2.el7.x86_64.rpm
mysql-community-embedded-compat-8.0.16-2.el7.x86_64.rpm
mysql-community-devel-8.0.16-2.el7.x86_64.rpm
mysql-community-server-8.0.16-2.el7.x86_64.rpm
mysql-community-libs-compat-8.0.16-2.el7.x86_64.rpm
mysql-community-client-8.0.16-2.el7.x86_64.rpm
mysql-community-common-8.0.16-2.el7.x86_64.rpm
mysql-community-test-8.0.16-2.el7.x86_64.rpm
技术图片

 

进入解压后的目录,安装

技术图片
[root@localhost soft]# cd mysql8/
[root@localhost mysql8]# yum install mysql-community-{server,client,common,libs}-*
Loaded plugins: fastestmirror, langpacks
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
--> Finished Dependency Resolution
base/7/x86_64                                                                                                                                                                                                             | 3.6 kB  00:00:00     
extras/7/x86_64                                                                                                                                                                                                           | 3.4 kB  00:00:00     
updates/7/x86_64                                                                                                                                                                                                          | 3.4 kB  00:00:00     

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

Transaction Summary
=================================================================================================================================================================================================================================================
Install  5 Packages

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

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  

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

Complete!
技术图片

 

到此就安装结束,下面开启防火墙端口3306并启动。开启防火墙端口是希望外界可以访问。

技术图片
[root@localhost mysql8]# firewall-cmd --zone=public --add-port=3306/tcp --permanent
success
[root@localhost mysql8]# systemctl restart firewalld
[root@localhost mysql8]# systemctl start mysqld
[root@localhost mysql8]# systemctl status mysqld
● mysqld.service - MySQL Server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
   Active: active (running) since Fri 2019-05-24 05:20:29 CST; 5s ago
     Docs: man:mysqld(8)
           http://dev.mysql.com/doc/refman/en/using-systemd.html
  Process: 8804 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
 Main PID: 8888 (mysqld)
   Status: "SERVER_OPERATING"
    Tasks: 38
   CGroup: /system.slice/mysqld.service
           └─8888 /usr/sbin/mysqld

May 24 05:20:14 localhost.localdomain systemd[1]: Starting MySQL Server...
May 24 05:20:29 localhost.localdomain systemd[1]: Started MySQL Server.
技术图片

 

下面因为第一次启动,需要修改密码。

技术图片
[root@localhost mysql8]# cat /var/log/mysqld.log | grep password
2019-05-23T21:20:25.393815Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: U3ZlzC>KAAc<
[root@localhost mysql8]# 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.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> ALTER USER USER() IDENTIFIED BY ‘Abc123-S‘;
Query OK, 0 rows affected (0.02 sec)
技术图片

 

到此安装以及初始化完毕,你可以在此执行一些SQL语句。

用Navicat连接

你要创建一个新用户并授权。

mysql> CREATE USER ‘tom‘@‘%‘ IDENTIFIED BY ‘Abc123-S‘;
Query OK, 0 rows affected (0.02 sec)

mysql> GRANT ALL ON *.* TO ‘tom‘@‘%‘;
Query OK, 0 rows affected (0.02 sec)

 

连接的时候会出现

技术图片

这是因为不支持当前的加密协议。MySQL8 创建用户默认使用caching_sha2_password,所以我们可以更改为MySQL5.7的mysql_native_password。

mysql> ALTER USER ‘tom‘@‘%‘ IDENTIFIED WITH mysql_native_password BY ‘Abc123-S‘;
Query OK, 0 rows affected (0.00 sec)

mysql8安装

标签:mbed   mkdir   ystemd   RoCE   tool   pass   pat   ble   cal   

原文地址:https://www.cnblogs.com/leigepython/p/12372393.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!