centos 7.6 安装mysql 5.7.35

news2024/11/26 17:38:07

centos 7.6 安装mysql 5.7.35

  • 1、下载mysql安装包
  • 2、安装文档
  • 3、安装MySQL包
  • 4、安装后形成的配置文件和程序位置
  • 5、安装后设置
    • 5.1、修改MySQL root账户默认密码
    • 5.2、关闭系统防火墙
  • 6、使用mysql 5.7.35 数据库
    • 6.1、命令行登录MySQL 5.7.35 数据库
    • 6.2、navicat连接mysql 5.7.35 数据库
    • 6.3、mysql数据库常用命令<5.7.35版本>
      • 6.3.1、初始化默认数据库

1、下载mysql安装包

访问官方下载页面下载bundle安装包
https://downloads.mysql.com/archives/community/

文件名:mysql-5.7.35-1.el7.x86_64.rpm-bundle.tar
MD5: 99c03ce2fe9c57d3f76f59f7211be900

在这里插入图片描述

下载文件 然后解压

mkdir -p /root/package/mysql/mysql-5.7.35-1.el7.x86_64.rpm-bundle
cd /root/package/mysql/
tar -xvf mysql-5.7.35-1.el7.x86_64.rpm-bundle.tar -C mysql-5.7.35-1.el7.x86_64.rpm-bundle

解压后的文件如图

[root@centos mysql]# tar -xvf mysql-5.7.35-1.el7.x86_64.rpm-bundle.tar -C mysql-5.7.35-1.el7.x86_64.rpm-bundle
mysql-community-client-5.7.35-1.el7.x86_64.rpm
mysql-community-common-5.7.35-1.el7.x86_64.rpm
mysql-community-devel-5.7.35-1.el7.x86_64.rpm
mysql-community-embedded-5.7.35-1.el7.x86_64.rpm
mysql-community-embedded-compat-5.7.35-1.el7.x86_64.rpm
mysql-community-embedded-devel-5.7.35-1.el7.x86_64.rpm
mysql-community-libs-5.7.35-1.el7.x86_64.rpm
mysql-community-libs-compat-5.7.35-1.el7.x86_64.rpm
mysql-community-server-5.7.35-1.el7.x86_64.rpm
mysql-community-test-5.7.35-1.el7.x86_64.rpm
[root@centos mysql]# 

2、安装文档

https://dev.mysql.com/doc/refman/5.7/en/linux-installation-rpm.html

3、安装MySQL包

查看包文件

root@debian:~/package/mysql/mysql-server_5.7.41-1debian10_amd64.deb-bundle# ls -lh
total 159M
-rw-r--r-- 1 7155 31415 1.8M Dec  7 12:50 libmysqlclient20_5.7.41-1debian10_amd64.deb
-rw-r--r-- 1 7155 31415 2.3M Dec  7 12:51 libmysqlclient-dev_5.7.41-1debian10_amd64.deb
-rw-r--r-- 1 7155 31415  20M Dec  7 12:50 libmysqld-dev_5.7.41-1debian10_amd64.deb
-rw-r--r-- 1 7155 31415  69K Dec  7 12:50 mysql-client_5.7.41-1debian10_amd64.deb
-rw-r--r-- 1 7155 31415  72K Dec  7 12:50 mysql-common_5.7.41-1debian10_amd64.deb
-rw-r--r-- 1 7155 31415  15M Dec  7 12:50 mysql-community-client_5.7.41-1debian10_amd64.deb
-rw-r--r-- 1 7155 31415  38M Dec  7 12:50 mysql-community-server_5.7.41-1debian10_amd64.deb
-rw-r--r-- 1 7155 31415  52M Dec  7 12:50 mysql-community-source_5.7.41-1debian10_amd64.deb
-rw-r--r-- 1 7155 31415  32M Dec  7 12:50 mysql-community-test_5.7.41-1debian10_amd64.deb
-rw-r--r-- 1 7155 31415  69K Dec  7 12:51 mysql-server_5.7.41-1debian10_amd64.deb
-rw-r--r-- 1 7155 31415  69K Dec  7 12:50 mysql-testsuite_5.7.41-1debian10_amd64.deb
root@debian:~/package/mysql/mysql-server_5.7.41-1debian10_amd64.deb-bundle# 

安装包 安装过程中yum会自动解决依赖关系 并安装所需要的依赖包

yum install /root/package/mysql/mysql-5.7.35-1.el7.x86_64.rpm-bundle/mysql-community-{server,client,common,libs}-* mysql-5.*
[root@centos ~]# yum install /root/package/mysql/mysql-5.7.35-1.el7.x86_64.rpm-bundle/mysql-community-{server,client,common,libs}-* mysql-5.*
Loaded plugins: fastestmirror
Examining /root/package/mysql/mysql-5.7.35-1.el7.x86_64.rpm-bundle/mysql-community-server-5.7.35-1.el7.x86_64.rpm: mysql-community-server-5.7.35-1.el7.x86_64
Marking /root/package/mysql/mysql-5.7.35-1.el7.x86_64.rpm-bundle/mysql-community-server-5.7.35-1.el7.x86_64.rpm to be installed
Examining /root/package/mysql/mysql-5.7.35-1.el7.x86_64.rpm-bundle/mysql-community-client-5.7.35-1.el7.x86_64.rpm: mysql-community-client-5.7.35-1.el7.x86_64
Marking /root/package/mysql/mysql-5.7.35-1.el7.x86_64.rpm-bundle/mysql-community-client-5.7.35-1.el7.x86_64.rpm to be installed
Examining /root/package/mysql/mysql-5.7.35-1.el7.x86_64.rpm-bundle/mysql-community-common-5.7.35-1.el7.x86_64.rpm: mysql-community-common-5.7.35-1.el7.x86_64
Marking /root/package/mysql/mysql-5.7.35-1.el7.x86_64.rpm-bundle/mysql-community-common-5.7.35-1.el7.x86_64.rpm to be installed
Examining /root/package/mysql/mysql-5.7.35-1.el7.x86_64.rpm-bundle/mysql-community-libs-5.7.35-1.el7.x86_64.rpm: mysql-community-libs-5.7.35-1.el7.x86_64
Marking /root/package/mysql/mysql-5.7.35-1.el7.x86_64.rpm-bundle/mysql-community-libs-5.7.35-1.el7.x86_64.rpm to be installed
Examining /root/package/mysql/mysql-5.7.35-1.el7.x86_64.rpm-bundle/mysql-community-libs-compat-5.7.35-1.el7.x86_64.rpm: mysql-community-libs-compat-5.7.35-1.el7.x86_64
Marking /root/package/mysql/mysql-5.7.35-1.el7.x86_64.rpm-bundle/mysql-community-libs-compat-5.7.35-1.el7.x86_64.rpm to be installed
Loading mirror speeds from cached hostfile
No package mysql-5.* available.
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:5.7.35-1.el7 will be installed
---> Package mysql-community-common.x86_64 0:5.7.35-1.el7 will be installed
---> Package mysql-community-libs.x86_64 0:5.7.35-1.el7 will be obsoleting
---> Package mysql-community-libs-compat.x86_64 0:5.7.35-1.el7 will be obsoleting
---> Package mysql-community-server.x86_64 0:5.7.35-1.el7 will be installed
--> Processing Dependency: /usr/bin/perl for package: mysql-community-server-5.7.35-1.el7.x86_64
--> Processing Dependency: net-tools for package: mysql-community-server-5.7.35-1.el7.x86_64
--> Processing Dependency: perl(Getopt::Long) for package: mysql-community-server-5.7.35-1.el7.x86_64
--> Processing Dependency: perl(strict) for package: mysql-community-server-5.7.35-1.el7.x86_64
--> Running transaction check
---> Package net-tools.x86_64 0:2.0-0.25.20131004git.el7 will be installed
---> Package perl.x86_64 4:5.16.3-299.el7_9 will be installed
--> Processing Dependency: perl-libs = 4:5.16.3-299.el7_9 for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl(Socket) >= 1.3 for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl(Scalar::Util) >= 1.10 for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl-macros for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl-libs for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl(threads::shared) for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl(threads) for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl(constant) for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl(Time::Local) for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl(Time::HiRes) for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl(Storable) for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl(Socket) for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl(Scalar::Util) for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl(Pod::Simple::XHTML) for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl(Pod::Simple::Search) for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl(Filter::Util::Call) for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl(File::Temp) for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl(File::Spec::Unix) for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl(File::Spec::Functions) for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl(File::Spec) for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl(File::Path) for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl(Exporter) for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl(Cwd) for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl(Carp) for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: libperl.so()(64bit) for package: 4:perl-5.16.3-299.el7_9.x86_64
---> Package perl-Getopt-Long.noarch 0:2.40-3.el7 will be installed
--> Processing Dependency: perl(Pod::Usage) >= 1.14 for package: perl-Getopt-Long-2.40-3.el7.noarch
--> Processing Dependency: perl(Text::ParseWords) for package: perl-Getopt-Long-2.40-3.el7.noarch
--> Running transaction check
---> Package perl-Carp.noarch 0:1.26-244.el7 will be installed
---> Package perl-Exporter.noarch 0:5.68-3.el7 will be installed
---> Package perl-File-Path.noarch 0:2.09-2.el7 will be installed
---> Package perl-File-Temp.noarch 0:0.23.01-3.el7 will be installed
---> Package perl-Filter.x86_64 0:1.49-3.el7 will be installed
---> Package perl-PathTools.x86_64 0:3.40-5.el7 will be installed
---> Package perl-Pod-Simple.noarch 1:3.28-4.el7 will be installed
--> Processing Dependency: perl(Pod::Escapes) >= 1.04 for package: 1:perl-Pod-Simple-3.28-4.el7.noarch
--> Processing Dependency: perl(Encode) for package: 1:perl-Pod-Simple-3.28-4.el7.noarch
---> Package perl-Pod-Usage.noarch 0:1.63-3.el7 will be installed
--> Processing Dependency: perl(Pod::Text) >= 3.15 for package: perl-Pod-Usage-1.63-3.el7.noarch
--> Processing Dependency: perl-Pod-Perldoc for package: perl-Pod-Usage-1.63-3.el7.noarch
---> Package perl-Scalar-List-Utils.x86_64 0:1.27-248.el7 will be installed
---> Package perl-Socket.x86_64 0:2.010-5.el7 will be installed
---> Package perl-Storable.x86_64 0:2.45-3.el7 will be installed
---> Package perl-Text-ParseWords.noarch 0:3.29-4.el7 will be installed
---> Package perl-Time-HiRes.x86_64 4:1.9725-3.el7 will be installed
---> Package perl-Time-Local.noarch 0:1.2300-2.el7 will be installed
---> Package perl-constant.noarch 0:1.27-2.el7 will be installed
---> Package perl-libs.x86_64 4:5.16.3-299.el7_9 will be installed
---> Package perl-macros.x86_64 4:5.16.3-299.el7_9 will be installed
---> Package perl-threads.x86_64 0:1.87-4.el7 will be installed
---> Package perl-threads-shared.x86_64 0:1.43-6.el7 will be installed
--> Running transaction check
---> Package perl-Encode.x86_64 0:2.51-7.el7 will be installed
---> Package perl-Pod-Escapes.noarch 1:1.04-299.el7_9 will be installed
---> Package perl-Pod-Perldoc.noarch 0:3.20-4.el7 will be installed
--> Processing Dependency: perl(parent) for package: perl-Pod-Perldoc-3.20-4.el7.noarch
--> Processing Dependency: perl(HTTP::Tiny) for package: perl-Pod-Perldoc-3.20-4.el7.noarch
---> Package perl-podlators.noarch 0:2.5.1-3.el7 will be installed
--> Running transaction check
---> Package perl-HTTP-Tiny.noarch 0:0.033-3.el7 will be installed
---> Package perl-parent.noarch 1:0.225-244.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=================================================================================================================================================================================================================
 Package                                            Arch                          Version                                          Repository                                                               Size
=================================================================================================================================================================================================================
Installing:
 mysql-community-client                             x86_64                        5.7.35-1.el7                                     /mysql-community-client-5.7.35-1.el7.x86_64                             102 M
 mysql-community-common                             x86_64                        5.7.35-1.el7                                     /mysql-community-common-5.7.35-1.el7.x86_64                             2.8 M
 mysql-community-libs                               x86_64                        5.7.35-1.el7                                     /mysql-community-libs-5.7.35-1.el7.x86_64                               9.5 M
     replacing  mariadb-libs.x86_64 1:5.5.60-1.el7_5
 mysql-community-libs-compat                        x86_64                        5.7.35-1.el7                                     /mysql-community-libs-compat-5.7.35-1.el7.x86_64                        6.0 M
     replacing  mariadb-libs.x86_64 1:5.5.60-1.el7_5
 mysql-community-server                             x86_64                        5.7.35-1.el7                                     /mysql-community-server-5.7.35-1.el7.x86_64                             763 M
Installing for dependencies:
 net-tools                                          x86_64                        2.0-0.25.20131004git.el7                         base                                                                    306 k
 perl                                               x86_64                        4:5.16.3-299.el7_9                               updates                                                                 8.0 M
 perl-Carp                                          noarch                        1.26-244.el7                                     base                                                                     19 k
 perl-Encode                                        x86_64                        2.51-7.el7                                       base                                                                    1.5 M
 perl-Exporter                                      noarch                        5.68-3.el7                                       base                                                                     28 k
 perl-File-Path                                     noarch                        2.09-2.el7                                       base                                                                     26 k
 perl-File-Temp                                     noarch                        0.23.01-3.el7                                    base                                                                     56 k
 perl-Filter                                        x86_64                        1.49-3.el7                                       base                                                                     76 k
 perl-Getopt-Long                                   noarch                        2.40-3.el7                                       base                                                                     56 k
 perl-HTTP-Tiny                                     noarch                        0.033-3.el7                                      base                                                                     38 k
 perl-PathTools                                     x86_64                        3.40-5.el7                                       base                                                                     82 k
 perl-Pod-Escapes                                   noarch                        1:1.04-299.el7_9                                 updates                                                                  52 k
 perl-Pod-Perldoc                                   noarch                        3.20-4.el7                                       base                                                                     87 k
 perl-Pod-Simple                                    noarch                        1:3.28-4.el7                                     base                                                                    216 k
 perl-Pod-Usage                                     noarch                        1.63-3.el7                                       base                                                                     27 k
 perl-Scalar-List-Utils                             x86_64                        1.27-248.el7                                     base                                                                     36 k
 perl-Socket                                        x86_64                        2.010-5.el7                                      base                                                                     49 k
 perl-Storable                                      x86_64                        2.45-3.el7                                       base                                                                     77 k
 perl-Text-ParseWords                               noarch                        3.29-4.el7                                       base                                                                     14 k
 perl-Time-HiRes                                    x86_64                        4:1.9725-3.el7                                   base                                                                     45 k
 perl-Time-Local                                    noarch                        1.2300-2.el7                                     base                                                                     24 k
 perl-constant                                      noarch                        1.27-2.el7                                       base                                                                     19 k
 perl-libs                                          x86_64                        4:5.16.3-299.el7_9                               updates                                                                 690 k
 perl-macros                                        x86_64                        4:5.16.3-299.el7_9                               updates                                                                  44 k
 perl-parent                                        noarch                        1:0.225-244.el7                                  base                                                                     12 k
 perl-podlators                                     noarch                        2.5.1-3.el7                                      base                                                                    112 k
 perl-threads                                       x86_64                        1.87-4.el7                                       base                                                                     49 k
 perl-threads-shared                                x86_64                        1.43-6.el7                                       base                                                                     39 k

Transaction Summary
=================================================================================================================================================================================================================
Install  5 Packages (+28 Dependent packages)

Total size: 895 M
Total download size: 12 M
Is this ok [y/d/N]: y
Downloading packages:
(1/28): net-tools-2.0-0.25.20131004git.el7.x86_64.rpm                                                                                                                                     | 306 kB  00:00:00     
(2/28): perl-Carp-1.26-244.el7.noarch.rpm                                                                                                                                                 |  19 kB  00:00:00     
(3/28): perl-Exporter-5.68-3.el7.noarch.rpm                                                                                                                                               |  28 kB  00:00:00     
(4/28): perl-File-Path-2.09-2.el7.noarch.rpm                                                                                                                                              |  26 kB  00:00:00     
(5/28): perl-File-Temp-0.23.01-3.el7.noarch.rpm                                                                                                                                           |  56 kB  00:00:00     
(6/28): perl-Filter-1.49-3.el7.x86_64.rpm                                                                                                                                                 |  76 kB  00:00:00     
(7/28): perl-Getopt-Long-2.40-3.el7.noarch.rpm                                                                                                                                            |  56 kB  00:00:00     
(8/28): perl-Encode-2.51-7.el7.x86_64.rpm                                                                                                                                                 | 1.5 MB  00:00:00     
(9/28): perl-HTTP-Tiny-0.033-3.el7.noarch.rpm                                                                                                                                             |  38 kB  00:00:00     
(10/28): perl-PathTools-3.40-5.el7.x86_64.rpm                                                                                                                                             |  82 kB  00:00:00     
(11/28): perl-Pod-Perldoc-3.20-4.el7.noarch.rpm                                                                                                                                           |  87 kB  00:00:00     
(12/28): perl-Pod-Usage-1.63-3.el7.noarch.rpm                                                                                                                                             |  27 kB  00:00:00     
(13/28): perl-Scalar-List-Utils-1.27-248.el7.x86_64.rpm                                                                                                                                   |  36 kB  00:00:00     
(14/28): perl-Socket-2.010-5.el7.x86_64.rpm                                                                                                                                               |  49 kB  00:00:00     
(15/28): perl-Storable-2.45-3.el7.x86_64.rpm                                                                                                                                              |  77 kB  00:00:00     
(16/28): perl-Text-ParseWords-3.29-4.el7.noarch.rpm                                                                                                                                       |  14 kB  00:00:00     
(17/28): perl-Time-HiRes-1.9725-3.el7.x86_64.rpm                                                                                                                                          |  45 kB  00:00:00     
(18/28): perl-Time-Local-1.2300-2.el7.noarch.rpm                                                                                                                                          |  24 kB  00:00:00     
(19/28): perl-constant-1.27-2.el7.noarch.rpm                                                                                                                                              |  19 kB  00:00:00     
(20/28): perl-Pod-Escapes-1.04-299.el7_9.noarch.rpm                                                                                                                                       |  52 kB  00:00:00     
(21/28): perl-Pod-Simple-3.28-4.el7.noarch.rpm                                                                                                                                            | 216 kB  00:00:00     
(22/28): perl-libs-5.16.3-299.el7_9.x86_64.rpm                                                                                                                                            | 690 kB  00:00:00     
(23/28): perl-macros-5.16.3-299.el7_9.x86_64.rpm                                                                                                                                          |  44 kB  00:00:00     
(24/28): perl-5.16.3-299.el7_9.x86_64.rpm                                                                                                                                                 | 8.0 MB  00:00:01     
(25/28): perl-parent-0.225-244.el7.noarch.rpm                                                                                                                                             |  12 kB  00:00:00     
(26/28): perl-threads-1.87-4.el7.x86_64.rpm                                                                                                                                               |  49 kB  00:00:00     
(27/28): perl-threads-shared-1.43-6.el7.x86_64.rpm                                                                                                                                        |  39 kB  00:00:00     
(28/28): perl-podlators-2.5.1-3.el7.noarch.rpm                                                                                                                                            | 112 kB  00:00:00     
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                            6.4 MB/s |  12 MB  00:00:01     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : mysql-community-common-5.7.35-1.el7.x86_64                                                                                                                                                   1/34 
  Installing : mysql-community-libs-5.7.35-1.el7.x86_64                                                                                                                                                     2/34 
  Installing : mysql-community-client-5.7.35-1.el7.x86_64                                                                                                                                                   3/34 
  Installing : 1:perl-parent-0.225-244.el7.noarch                                                                                                                                                           4/34 
  Installing : perl-HTTP-Tiny-0.033-3.el7.noarch                                                                                                                                                            5/34 
  Installing : perl-podlators-2.5.1-3.el7.noarch                                                                                                                                                            6/34 
  Installing : perl-Pod-Perldoc-3.20-4.el7.noarch                                                                                                                                                           7/34 
  Installing : 1:perl-Pod-Escapes-1.04-299.el7_9.noarch                                                                                                                                                     8/34 
  Installing : perl-Encode-2.51-7.el7.x86_64                                                                                                                                                                9/34 
  Installing : perl-Text-ParseWords-3.29-4.el7.noarch                                                                                                                                                      10/34 
  Installing : perl-Pod-Usage-1.63-3.el7.noarch                                                                                                                                                            11/34 
  Installing : 4:perl-macros-5.16.3-299.el7_9.x86_64                                                                                                                                                       12/34 
  Installing : perl-Storable-2.45-3.el7.x86_64                                                                                                                                                             13/34 
  Installing : perl-Exporter-5.68-3.el7.noarch                                                                                                                                                             14/34 
  Installing : perl-constant-1.27-2.el7.noarch                                                                                                                                                             15/34 
  Installing : perl-Socket-2.010-5.el7.x86_64                                                                                                                                                              16/34 
  Installing : perl-Time-Local-1.2300-2.el7.noarch                                                                                                                                                         17/34 
  Installing : perl-Carp-1.26-244.el7.noarch                                                                                                                                                               18/34 
  Installing : 4:perl-Time-HiRes-1.9725-3.el7.x86_64                                                                                                                                                       19/34 
  Installing : perl-PathTools-3.40-5.el7.x86_64                                                                                                                                                            20/34 
  Installing : perl-Scalar-List-Utils-1.27-248.el7.x86_64                                                                                                                                                  21/34 
  Installing : 1:perl-Pod-Simple-3.28-4.el7.noarch                                                                                                                                                         22/34 
  Installing : perl-File-Temp-0.23.01-3.el7.noarch                                                                                                                                                         23/34 
  Installing : perl-File-Path-2.09-2.el7.noarch                                                                                                                                                            24/34 
  Installing : perl-threads-shared-1.43-6.el7.x86_64                                                                                                                                                       25/34 
  Installing : perl-threads-1.87-4.el7.x86_64                                                                                                                                                              26/34 
  Installing : perl-Filter-1.49-3.el7.x86_64                                                                                                                                                               27/34 
  Installing : 4:perl-libs-5.16.3-299.el7_9.x86_64                                                                                                                                                         28/34 
  Installing : perl-Getopt-Long-2.40-3.el7.noarch                                                                                                                                                          29/34 
  Installing : 4:perl-5.16.3-299.el7_9.x86_64                                                                                                                                                              30/34 
  Installing : net-tools-2.0-0.25.20131004git.el7.x86_64                                                                                                                                                   31/34 
  Installing : mysql-community-server-5.7.35-1.el7.x86_64                                                                                                                                                  32/34 
  Installing : mysql-community-libs-compat-5.7.35-1.el7.x86_64                                                                                                                                             33/34 
  Erasing    : 1:mariadb-libs-5.5.60-1.el7_5.x86_64                                                                                                                                                        34/34 
  Verifying  : mysql-community-server-5.7.35-1.el7.x86_64                                                                                                                                                   1/34 
  Verifying  : perl-HTTP-Tiny-0.033-3.el7.noarch                                                                                                                                                            2/34 
  Verifying  : perl-threads-shared-1.43-6.el7.x86_64                                                                                                                                                        3/34 
  Verifying  : perl-Storable-2.45-3.el7.x86_64                                                                                                                                                              4/34 
  Verifying  : perl-Exporter-5.68-3.el7.noarch                                                                                                                                                              5/34 
  Verifying  : perl-constant-1.27-2.el7.noarch                                                                                                                                                              6/34 
  Verifying  : perl-PathTools-3.40-5.el7.x86_64                                                                                                                                                             7/34 
  Verifying  : perl-Socket-2.010-5.el7.x86_64                                                                                                                                                               8/34 
  Verifying  : 1:perl-parent-0.225-244.el7.noarch                                                                                                                                                           9/34 
  Verifying  : 4:perl-macros-5.16.3-299.el7_9.x86_64                                                                                                                                                       10/34 
  Verifying  : mysql-community-client-5.7.35-1.el7.x86_64                                                                                                                                                  11/34 
  Verifying  : mysql-community-libs-5.7.35-1.el7.x86_64                                                                                                                                                    12/34 
  Verifying  : perl-File-Temp-0.23.01-3.el7.noarch                                                                                                                                                         13/34 
  Verifying  : net-tools-2.0-0.25.20131004git.el7.x86_64                                                                                                                                                   14/34 
  Verifying  : 1:perl-Pod-Simple-3.28-4.el7.noarch                                                                                                                                                         15/34 
  Verifying  : perl-Time-Local-1.2300-2.el7.noarch                                                                                                                                                         16/34 
  Verifying  : 1:perl-Pod-Escapes-1.04-299.el7_9.noarch                                                                                                                                                    17/34 
  Verifying  : perl-Carp-1.26-244.el7.noarch                                                                                                                                                               18/34 
  Verifying  : 4:perl-Time-HiRes-1.9725-3.el7.x86_64                                                                                                                                                       19/34 
  Verifying  : perl-Scalar-List-Utils-1.27-248.el7.x86_64                                                                                                                                                  20/34 
  Verifying  : mysql-community-libs-compat-5.7.35-1.el7.x86_64                                                                                                                                             21/34 
  Verifying  : perl-Pod-Usage-1.63-3.el7.noarch                                                                                                                                                            22/34 
  Verifying  : perl-Encode-2.51-7.el7.x86_64                                                                                                                                                               23/34 
  Verifying  : perl-Pod-Perldoc-3.20-4.el7.noarch                                                                                                                                                          24/34 
  Verifying  : perl-podlators-2.5.1-3.el7.noarch                                                                                                                                                           25/34 
  Verifying  : 4:perl-5.16.3-299.el7_9.x86_64                                                                                                                                                              26/34 
  Verifying  : perl-File-Path-2.09-2.el7.noarch                                                                                                                                                            27/34 
  Verifying  : perl-threads-1.87-4.el7.x86_64                                                                                                                                                              28/34 
  Verifying  : mysql-community-common-5.7.35-1.el7.x86_64                                                                                                                                                  29/34 
  Verifying  : perl-Filter-1.49-3.el7.x86_64                                                                                                                                                               30/34 
  Verifying  : perl-Getopt-Long-2.40-3.el7.noarch                                                                                                                                                          31/34 
  Verifying  : perl-Text-ParseWords-3.29-4.el7.noarch                                                                                                                                                      32/34 
  Verifying  : 4:perl-libs-5.16.3-299.el7_9.x86_64                                                                                                                                                         33/34 
  Verifying  : 1:mariadb-libs-5.5.60-1.el7_5.x86_64                                                                                                                                                        34/34 

Installed:
  mysql-community-client.x86_64 0:5.7.35-1.el7       mysql-community-common.x86_64 0:5.7.35-1.el7       mysql-community-libs.x86_64 0:5.7.35-1.el7       mysql-community-libs-compat.x86_64 0:5.7.35-1.el7      
  mysql-community-server.x86_64 0:5.7.35-1.el7      

Dependency Installed:
  net-tools.x86_64 0:2.0-0.25.20131004git.el7  perl.x86_64 4:5.16.3-299.el7_9           perl-Carp.noarch 0:1.26-244.el7         perl-Encode.x86_64 0:2.51-7.el7          perl-Exporter.noarch 0:5.68-3.el7    
  perl-File-Path.noarch 0:2.09-2.el7           perl-File-Temp.noarch 0:0.23.01-3.el7    perl-Filter.x86_64 0:1.49-3.el7         perl-Getopt-Long.noarch 0:2.40-3.el7     perl-HTTP-Tiny.noarch 0:0.033-3.el7  
  perl-PathTools.x86_64 0:3.40-5.el7           perl-Pod-Escapes.noarch 1:1.04-299.el7_9 perl-Pod-Perldoc.noarch 0:3.20-4.el7    perl-Pod-Simple.noarch 1:3.28-4.el7      perl-Pod-Usage.noarch 0:1.63-3.el7   
  perl-Scalar-List-Utils.x86_64 0:1.27-248.el7 perl-Socket.x86_64 0:2.010-5.el7         perl-Storable.x86_64 0:2.45-3.el7       perl-Text-ParseWords.noarch 0:3.29-4.el7 perl-Time-HiRes.x86_64 4:1.9725-3.el7
  perl-Time-Local.noarch 0:1.2300-2.el7        perl-constant.noarch 0:1.27-2.el7        perl-libs.x86_64 4:5.16.3-299.el7_9     perl-macros.x86_64 4:5.16.3-299.el7_9    perl-parent.noarch 1:0.225-244.el7   
  perl-podlators.noarch 0:2.5.1-3.el7          perl-threads.x86_64 0:1.87-4.el7         perl-threads-shared.x86_64 0:1.43-6.el7

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

Complete!
[root@centos ~]# 

此次安装是mysql数据库标准安装方式,只安装了这些包。没有安装开发包等其他包。

[root@centos ~]# ls -lh  /root/package/mysql/mysql-5.7.35-1.el7.x86_64.rpm-bundle/mysql-community-{server,client,common,libs}-* 
-rw-r--r--. 1 7155 31415  26M Jun  8  2021 /root/package/mysql/mysql-5.7.35-1.el7.x86_64.rpm-bundle/mysql-community-client-5.7.35-1.el7.x86_64.rpm
-rw-r--r--. 1 7155 31415 311K Jun  8  2021 /root/package/mysql/mysql-5.7.35-1.el7.x86_64.rpm-bundle/mysql-community-common-5.7.35-1.el7.x86_64.rpm
-rw-r--r--. 1 7155 31415 2.4M Jun  8  2021 /root/package/mysql/mysql-5.7.35-1.el7.x86_64.rpm-bundle/mysql-community-libs-5.7.35-1.el7.x86_64.rpm
-rw-r--r--. 1 7155 31415 1.3M Jun  8  2021 /root/package/mysql/mysql-5.7.35-1.el7.x86_64.rpm-bundle/mysql-community-libs-compat-5.7.35-1.el7.x86_64.rpm
-rw-r--r--. 1 7155 31415 174M Jun  8  2021 /root/package/mysql/mysql-5.7.35-1.el7.x86_64.rpm-bundle/mysql-community-server-5.7.35-1.el7.x86_64.rpm
[root@centos ~]# 

安装后会自动创建systemd服务
查看MySQL服务

systemctl status mysqld.service 
[root@centos ~]# systemctl status mysqld.service 
● 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@centos ~]# 

至此安装成功

安装后不会自动启动MySQL服务,手动开启服务

systemctl start mysqld.service

查看服务状态

systemctl status mysqld.service
[root@centos ~]# systemctl status mysqld.service 
● mysqld.service - MySQL Server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
   Active: active (running) since Mon 2023-05-15 03:05:58 EDT; 23s ago
     Docs: man:mysqld(8)
           http://dev.mysql.com/doc/refman/en/using-systemd.html
  Process: 18326 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS)
  Process: 18276 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
 Main PID: 18329 (mysqld)
   CGroup: /system.slice/mysqld.service
           └─18329 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid

May 15 03:05:48 centos systemd[1]: Starting MySQL Server...
May 15 03:05:58 centos systemd[1]: Started MySQL Server.
[root@centos ~]# 

在MySQL服务初次启动的过程中,做了以下操作:

  • The server is initialized
[root@centos ~]# systemctl status mysqld.service 
● mysqld.service - MySQL Server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
   Active: active (running) since Mon 2023-05-15 03:05:58 EDT; 23s ago
     Docs: man:mysqld(8)
           http://dev.mysql.com/doc/refman/en/using-systemd.html
  Process: 18326 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS)
  Process: 18276 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
 Main PID: 18329 (mysqld)
   CGroup: /system.slice/mysqld.service
           └─18329 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid

May 15 03:05:48 centos systemd[1]: Starting MySQL Server...
May 15 03:05:58 centos systemd[1]: Started MySQL Server.
[root@centos ~]# 
  • An SSL certificate and key files are generated in the data directory.

在这里插入图片描述

  • validate_password is installed and enabled.
Note
validate_password is installed by default. The default password policy implemented 
by validate_password requires that passwords contain at least one uppercase letter,
one lowercase letter, one digit, and one special character, and that the total 
password length is at least 8 characters.
  • A superuser account ‘root’@‘localhost’ is created. A password for the superuser is set and stored in the error log file.
    查看自动生成的MySQL root 用户密码
grep 'temporary password' /var/log/mysqld.log

在这里插入图片描述

4、安装后形成的配置文件和程序位置

Files or ResourcesLocation
Client programs and scripts/usr/bin
mysqld server/usr/sbin
Configuration file/etc/my.cnf
Data directory/var/lib/mysql
Error log fileFor RHEL, Oracle Linux, CentOS or Fedora platforms: /var/log/mysqld.log
Value of secure_file_priv/var/lib/mysql-files
System V init scriptFor RHEL, Oracle Linux, CentOS or Fedora platforms: /etc/init.d/mysqld
Systemd serviceFor RHEL, Oracle Linux, CentOS or Fedora platforms: mysqld
Pid file/var/run/mysql/mysqld.pid
Socket/var/lib/mysql/mysql.sock
Keyring directory/var/lib/mysql-keyring
Unix manual pages/usr/share/man
Include (header) files/usr/include/mysql
Libraries/usr/lib/mysql
Miscellaneous support files (for example, error messages, and character set files)/usr/share/mysql

5、安装后设置

5.1、修改MySQL root账户默认密码

执行以下SQL语句修改密码复杂度校验校验规则为只包含数字、校验长度为1、设置root密码为123456、赋予root用户远程连接权限。

SET GLOBAL validate_password_policy = 0;


SET GLOBAL validate_password_length = 1;


SET PASSWORD = PASSWORD ("123456");

commit;

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;

commit;

不修改无法执行数据库命令
在这里插入图片描述

在这里插入图片描述

密码校验长度设置是1,实际设置的是4。设置为1是不允许的。

在这里插入图片描述

5.2、关闭系统防火墙

systemctl stop firewalld.service

不关闭防火墙的话 MySQL连接不上

6、使用mysql 5.7.35 数据库

6.1、命令行登录MySQL 5.7.35 数据库

登录数据库root账户 密码是安装MySQL时设置的root账户密码

mysql -uroot -p

使用安装后自动生成的MySQL root 用户密码登录

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

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> 

查看默认所有数据库

show databases;
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.00 sec)

mysql> 

创建数据库

create database test;
mysql> create database test;
Query OK, 1 row affected (0.00 sec)

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
| test               |
+--------------------+
5 rows in set (0.00 sec)

mysql> 

6.2、navicat连接mysql 5.7.35 数据库

新建连接 选择mysql

在这里插入图片描述

点击确定

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

新建查询

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

6.3、mysql数据库常用命令<5.7.35版本>

6.3.1、初始化默认数据库

初始化默认数据库

mysqld --initialize --console

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

mysqld命令帮助查看:

mysqld --verbose --help|less

在这里插入图片描述

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/529352.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

酒精和肠内外健康:有帮助还是有害?

谷禾健康 酒精与健康 饮酒作为一种特殊的文化形式&#xff0c;在我们国家有其独特的地位&#xff0c;在几千年的发展中&#xff0c;酒几乎渗透到日常生活、社会经济、文化活动之中。 据2018年发表的《中国饮酒人群适量饮酒状况》白皮书数据显示&#xff0c;中国饮酒人群高达6亿…

MS5208数模转换器可pin对pin兼容DAC128S085

DAC128S085 是一款功能齐全的通用八通道 12 位电压输出数模转换器 &#xff08;DAC&#xff09;&#xff0c;可采用 2.7V 至 5.5V 单电源供电&#xff0c;3V 时功耗为 1.95mW&#xff0c;5 V 时功耗为 4.85mW。DAC128S085 采用 16 引脚 WQFN 封装和 16 引脚 TSSOP 封装。WQFN 封…

Convolutional Neural network(卷积神经网络)

目录 Why CNN for Image&#xff1f; The whole CNN structure Convolution&#xff08;卷积&#xff09; Max Pooling Flatten CNN in Keras What does CNN learn&#xff1f; what does filter do what does neuron do what about output Deep Dream Application Pla…

数据库缓存服务——NoSQL之Redis配置与优化

一、缓存概念 缓存是为了调节速度不一致的两个或多个不同的物质的速度&#xff0c;在中间对速度较慢的一方起到加速作用&#xff0c;比如CPU的一级、二级缓存是保存了CPU最近经常访问的数据&#xff0c;内存是保存CPU经常访问硬盘的数据&#xff0c;而且硬盘也有大小不一的缓存…

测试用例的设计方法

目录 测试用例的设计方法 等价类&#xff1a; 等价类分为有效等价类与无效等价类 分类树 边界值&#xff1a; 语法测试 正面测试&#xff1a; 负面测试&#xff1a; 判定表测试 因果图&#xff1a; 场景法&#xff1a; 随机测试&#xff1a; 希望能起到帮助&#xf…

关于使用pyinstaller来打包PySide2程序中的问题

打包 pyinstaller 02.py --noconsole --hidden-import PySide2.QtXml 报错0&#xff1a;The ‘pathlib‘ package is an obsolete backport of a standard library package 分析&#xff1a;这个是因为笔者使用的conda的集成环境&#xff0c;这里面自带了打包程序&#xff0c…

Cocos creator小游戏实现套牛小游戏资源及代码

Cocos creator实现套牛小游戏资源及代码 一 安装CocosDashBoard二 新建2D项目RunCow1、管理项目目录2、搭建界面 三 上线微信小游戏1、上线微信小游戏2、Cocos Creator代码打包上传3、上线微信小游戏出现问题 Cocos creator小游戏实现套牛小游戏资源及代码 最近在学习Cocos Cre…

23案例P135-员工部门增删改查实现

一、准备工作 需要完成tlias的部门管理和员工管理 创建tlias数据库&#xff0c;导入 -- 部门管理 create table dept(id int unsigned primary key auto_increment comment 主键ID,name varchar(10) not null unique comment 部门名称,create_time datetime not null commen…

软件I2C读写MPU6050代码

1、硬件电路 SCL引到了STM32的PB10号引脚&#xff0c;SDA引到了PB11号引脚软件I2C协议&#xff1a; 用普通GPIO口&#xff0c;手动反转电平实现协议&#xff0c;不需要STM32内部的外设资源支持&#xff0c;故端口是可以任意指定MPU605在SCL和SDA自带了两个上拉电阻&#xff0c;…

漏刻有时地理信息系统说明文档(LOCKGIS、php后台管理、三端一体PC-H5-微信小程序、百度地图jsAPI二次开发、标注弹窗导航)

漏刻有时地理信息系统LOCKGIS 前言一、运行环境&#xff08;一&#xff09;环境检查&#xff08;二&#xff09;权限检查&#xff08;三&#xff09;函数支持&#xff08;四&#xff09;域名相关 二、核心代码&#xff08;一&#xff09;坐标展示&#xff08;二&#xff09;实时…

Excel快捷键大全(2023最新版总结)

案例&#xff1a;Excel快捷键大全 【作为一名打工人&#xff0c;我总是要用到Excel表格&#xff0c;大家平常在使用Excel时都有什么比较好用的快捷键推荐吗&#xff1f;】 Excel是一款功能强大的电子表格软件&#xff0c;可以用于数据管理、计算、分析和报表生成等多种任务。…

HDFS的数据流

1.HDFS写数据流程 &#xff08;1&#xff09;客户端通过Distributed FileSystem模块向NameNode请求上传文件&#xff0c;NameNode检查目标文件是否已存在&#xff0c;父目录是否存在。 &#xff08;2&#xff09;NameNode返回是否可以上传。 &#xff08;3&#xff09;客户端…

Shell系统编程三剑客之----AWK

目录 1.AWK工具简介 2.AWK的基本格式 3.AWK工作原理 4.常见的内建变量&#xff08;可直接用&#xff09; 二&#xff1a; AWK实例 1.按行输出文本 2.按字段输出文本 3.通过管道、双引号调用 Shell 命令 4.date命令输出时间 5. 查看内存使用占比 6.查看cpu使用占比 7.…

【linux】shell编程—快捷命令

提示&#xff1a;文章写完后&#xff0c;目录可以自动生成&#xff0c;如何生成可参考右边的帮助文档 文章目录 一、快捷排序 - sort二、快捷去重 - uniq三、快捷替换 - tr四、快速裁剪 - cut五、文件拆分 - split六、文件合并 - paste七、变量扫描器 - eval 一、快捷排序 - so…

5个良心好用的Windows神级软件,让你打开新世界的大门

今天再次推荐5个良心好用的Windows神级软件&#xff0c;每一个都是完全免费&#xff0c;堪称神器&#xff0c;让你打开新世界的大门。 1.PPT插件——OneKeyTools OK插件是一款免费的PPT插件&#xff0c;让你的PPT制作有无限可能&#xff01;它的功能&#xff0c;太多了&#…

CoCo数据集-目标检测指标MAP

文章目录 一、前言二、评价指标的一些概念2.1.一些概念2.2.概念介绍2.3.MAP求解 三、理解CoCo的评价指标四、总结五、学习视频、Coco官方地址 一、前言 前面学习了coco数据集但是不知道它的评价指标&#xff0c;所以写下来作为自己的笔记&#xff0c;以后还是直接在这写好再保…

算法设计期末考试

算法设计期末考试 1.分治法3选11.1全排列1.2二分法--金块问题1.3子数组换位问题 2.贪心选2题2.1 活动安排2.2 活动安排&#xff08;改&#xff09;2.3 最优装载2.4 多机调度2.5 最优服务次序问题2.6 多处最优服务次序问题 3.动态规划选1-2题3.1最长公共子序列3.2最大子段和3.3 …

这个原因,让你自动化测试年薪30W+也不能躺平

其实这个问题&#xff0c;我们遇到到很多次&#xff1a; “自动化就可以满足我现在的公司需求&#xff0c;为什么不躺平&#xff0c;还要继续学测开&#xff1f;” 每次遇到这个问题后&#xff0c;立马就会有一个“涨薪效应”&#xff1a;收到粉丝们的高薪offer ​ 其实&#x…

星河案例ㅣ中国电信 X 冲量在线:基于智算中心的隐私计算应用实践

▏摘要 中国电信是中国三大运营商之一&#xff0c;为响应国家“东数西算”工程的全新数据中心形态&#xff0c;中国电信引入隐私计算平台&#xff0c;对内实现数据确权跟踪、对外实现数据共享交易&#xff0c;盘活中国电信分布在全国不同区域的数据资源和算力资源&#xff0c;…

软件测试行业对新人友好吗?为什么?

随着信息技术的迅猛发展&#xff0c;软件测试行业成为了一个备受青睐的职业领域&#xff0c;但是对于没有经验和专业背景的新人来说&#xff0c;进入这个行业是否容易&#xff0c;是否有足够的发展空间呢&#xff1f;接下来从多个方面分析和介绍。 如果你想学习软件测试&#…