学习报告:冬季实战营第一期

学习报告:冬季实战营第一期



快速搭建LAMP环境

一、创建资源

  1. 在页面中间,单击创建资源,创建所需资源。
  2. 在页面左侧导航栏中,单击云产品资源列表,查看本次实验资源相关信息。
说明:

资源创建过程需要1~3分钟。完成实验资源的创建后,您可以在云产品资源列表查看已创建的资源信息,例> 如:IP地址、用户名和密码等

二、安装Apache服务

Apache是世界使用排名第一的Web服务器软件。它可以运行在几乎所有广泛使用的计算机平台上,由于其跨平台和安全性被广泛使用,是最流行的Web服务器端软件之一。

  1. 在页面右侧,单击学习报告:冬季实战营第一期图标,切换至Web Terminal。
  1. 执行如下命令,安装Apache服务及其扩展包。
yum -y install httpd httpd-manual mod_ssl mod_perl mod_auth_mysql
返回类似如下结果则表示安装成功。
[root@iZuf68ebyms359ziewcgnaZ ~]# yum -y install httpd httpd-manual mod_ssl mod_perl mod_auth_mysql
Loaded plugins: fastestmirror
Determining fastest mirrors
base                                                                                                           | 3.6 kB  00:00:00     
epel                                                                                                           | 4.7 kB  00:00:00     
extras                                                                                                         | 2.9 kB  00:00:00     
updates                                                                                                        | 2.9 kB  00:00:00     
(1/7): epel/x86_64/group_gz                                                                                    |  96 kB  00:00:00     
(2/7): base/7/x86_64/group_gz                                                                                  | 153 kB  00:00:00     
(3/7): epel/x86_64/updateinfo                                                                                  | 1.0 MB  00:00:00     
(4/7): extras/7/x86_64/primary_db                                                                              | 243 kB  00:00:00     
(5/7): epel/x86_64/primary_db                                                                                  | 7.0 MB  00:00:00     
(6/7): base/7/x86_64/primary_db                                                                                | 6.1 MB  00:00:00     
(7/7): updates/7/x86_64/primary_db                                                                             |  13 MB  00:00:00     
No package mod_auth_mysql available.
Resolving Dependencies
--> Running transaction check
---> Package httpd.x86_64 0:2.4.6-97.el7.centos.2 will be installed
--> Processing Dependency: httpd-tools = 2.4.6-97.el7.centos.2 for package: httpd-2.4.6-97.el7.centos.2.x86_64
--> Processing Dependency: /etc/mime.types for package: httpd-2.4.6-97.el7.centos.2.x86_64
--> Processing Dependency: libaprutil-1.so.0()(64bit) for package: httpd-2.4.6-97.el7.centos.2.x86_64
--> Processing Dependency: libapr-1.so.0()(64bit) for package: httpd-2.4.6-97.el7.centos.2.x86_64
---> Package httpd-manual.noarch 0:2.4.6-97.el7.centos.2 will be installed
---> Package mod_perl.x86_64 0:2.0.11-1.el7 will be installed
--> Processing Dependency: perl(BSD::Resource) for package: mod_perl-2.0.11-1.el7.x86_64
--> Processing Dependency: perl(Data::Dumper) for package: mod_perl-2.0.11-1.el7.x86_64
--> Processing Dependency: perl(ExtUtils::MakeMaker) for package: mod_perl-2.0.11-1.el7.x86_64
--> Processing Dependency: perl(Linux::Pid) for package: mod_perl-2.0.11-1.el7.x86_64
---> Package mod_ssl.x86_64 1:2.4.6-97.el7.centos.2 will be installed
--> Running transaction check
---> Package apr.x86_64 0:1.4.8-7.el7 will be installed
---> Package apr-util.x86_64 0:1.5.2-6.el7 will be installed
---> Package httpd-tools.x86_64 0:2.4.6-97.el7.centos.2 will be installed
---> Package mailcap.noarch 0:2.1.41-2.el7 will be installed
---> Package perl-BSD-Resource.x86_64 0:1.29.07-1.el7 will be installed
---> Package perl-Data-Dumper.x86_64 0:2.145-3.el7 will be installed
---> Package perl-ExtUtils-MakeMaker.noarch 0:6.68-3.el7 will be installed
--> Processing Dependency: perl(Test::Harness) for package: perl-ExtUtils-MakeMaker-6.68-3.el7.noarch
--> Processing Dependency: perl(ExtUtils::Packlist) for package: perl-ExtUtils-MakeMaker-6.68-3.el7.noarch
--> Processing Dependency: perl(ExtUtils::Manifest) for package: perl-ExtUtils-MakeMaker-6.68-3.el7.noarch
--> Processing Dependency: perl(ExtUtils::Installed) for package: perl-ExtUtils-MakeMaker-6.68-3.el7.noarch
--> Processing Dependency: perl(ExtUtils::Install) for package: perl-ExtUtils-MakeMaker-6.68-3.el7.noarch
---> Package perl-Linux-Pid.x86_64 0:0.04-18.el7 will be installed
--> Running transaction check
---> Package perl-ExtUtils-Install.noarch 0:1.58-299.el7_9 will be installed
--> Processing Dependency: perl-devel for package: perl-ExtUtils-Install-1.58-299.el7_9.noarch
---> Package perl-ExtUtils-Manifest.noarch 0:1.61-244.el7 will be installed
---> Package perl-Test-Harness.noarch 0:3.28-3.el7 will be installed
--> Running transaction check
---> Package perl-devel.x86_64 4:5.16.3-299.el7_9 will be installed
--> Processing Dependency: systemtap-sdt-devel for package: 4:perl-devel-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl(ExtUtils::ParseXS) for package: 4:perl-devel-5.16.3-299.el7_9.x86_64
--> Processing Dependency: libdb-devel for package: 4:perl-devel-5.16.3-299.el7_9.x86_64
--> Processing Dependency: glibc-devel for package: 4:perl-devel-5.16.3-299.el7_9.x86_64
--> Processing Dependency: gdbm-devel for package: 4:perl-devel-5.16.3-299.el7_9.x86_64
--> Running transaction check
---> Package gdbm-devel.x86_64 0:1.10-8.el7 will be installed
---> Package glibc-devel.x86_64 0:2.17-325.el7_9 will be installed
--> Processing Dependency: glibc-headers = 2.17-325.el7_9 for package: glibc-devel-2.17-325.el7_9.x86_64
--> Processing Dependency: glibc = 2.17-325.el7_9 for package: glibc-devel-2.17-325.el7_9.x86_64
--> Processing Dependency: glibc-headers for package: glibc-devel-2.17-325.el7_9.x86_64
---> Package libdb-devel.x86_64 0:5.3.21-25.el7 will be installed
---> Package perl-ExtUtils-ParseXS.noarch 1:3.18-3.el7 will be installed
---> Package systemtap-sdt-devel.x86_64 0:4.0-13.el7 will be installed
--> Processing Dependency: pyparsing for package: systemtap-sdt-devel-4.0-13.el7.x86_64
--> Running transaction check
---> Package glibc.x86_64 0:2.17-292.el7 will be updated
--> Processing Dependency: glibc = 2.17-292.el7 for package: nscd-2.17-292.el7.x86_64
--> Processing Dependency: glibc = 2.17-292.el7 for package: glibc-common-2.17-292.el7.x86_64
---> Package glibc.x86_64 0:2.17-325.el7_9 will be an update
---> Package glibc-headers.x86_64 0:2.17-325.el7_9 will be installed
--> Processing Dependency: kernel-headers >= 2.2.1 for package: glibc-headers-2.17-325.el7_9.x86_64
--> Processing Dependency: kernel-headers for package: glibc-headers-2.17-325.el7_9.x86_64
---> Package pyparsing.noarch 0:1.5.6-9.el7 will be installed
--> Running transaction check
---> Package glibc-common.x86_64 0:2.17-292.el7 will be updated
---> Package glibc-common.x86_64 0:2.17-325.el7_9 will be an update
---> Package kernel-headers.x86_64 0:3.10.0-1160.53.1.el7 will be installed
---> Package nscd.x86_64 0:2.17-292.el7 will be updated
---> Package nscd.x86_64 0:2.17-325.el7_9 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================================================
 Package                                 Arch                   Version                                 Repository               Size
======================================================================================================================================
Installing:
 httpd                                   x86_64                 2.4.6-97.el7.centos.2                   updates                 2.7 M
 httpd-manual                            noarch                 2.4.6-97.el7.centos.2                   updates                 1.3 M
 mod_perl                                x86_64                 2.0.11-1.el7                            epel                    3.0 M
 mod_ssl                                 x86_64                 1:2.4.6-97.el7.centos.2                 updates                 115 k
Installing for dependencies:
 apr                                     x86_64                 1.4.8-7.el7                             base                    104 k
 apr-util                                x86_64                 1.5.2-6.el7                             base                     92 k
 gdbm-devel                              x86_64                 1.10-8.el7                              base                     47 k
 glibc-devel                             x86_64                 2.17-325.el7_9                          updates                 1.1 M
 glibc-headers                           x86_64                 2.17-325.el7_9                          updates                 691 k
 httpd-tools                             x86_64                 2.4.6-97.el7.centos.2                   updates                  94 k
 kernel-headers                          x86_64                 3.10.0-1160.53.1.el7                    updates                 9.0 M
 libdb-devel                             x86_64                 5.3.21-25.el7                           base                     39 k
 mailcap                                 noarch                 2.1.41-2.el7                            base                     31 k
 perl-BSD-Resource                       x86_64                 1.29.07-1.el7                           epel                     38 k
 perl-Data-Dumper                        x86_64                 2.145-3.el7                             base                     47 k
 perl-ExtUtils-Install                   noarch                 1.58-299.el7_9                          updates                  75 k
 perl-ExtUtils-MakeMaker                 noarch                 6.68-3.el7                              base                    275 k
 perl-ExtUtils-Manifest                  noarch                 1.61-244.el7                            base                     31 k
 perl-ExtUtils-ParseXS                   noarch                 1:3.18-3.el7                            base                     77 k
 perl-Linux-Pid                          x86_64                 0.04-18.el7                             epel                     14 k
 perl-Test-Harness                       noarch                 3.28-3.el7                              base                    302 k
 perl-devel                              x86_64                 4:5.16.3-299.el7_9                      updates                 454 k
 pyparsing                               noarch                 1.5.6-9.el7                             base                     94 k
 systemtap-sdt-devel                     x86_64                 4.0-13.el7                              base                     76 k
Updating for dependencies:
 glibc                                   x86_64                 2.17-325.el7_9                          updates                 3.6 M
 glibc-common                            x86_64                 2.17-325.el7_9                          updates                  12 M
 nscd                                    x86_64                 2.17-325.el7_9                          updates                 289 k

Transaction Summary
======================================================================================================================================
Install  4 Packages (+20 Dependent packages)
Upgrade             (  3 Dependent packages)

Total download size: 35 M
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(1/27): apr-1.4.8-7.el7.x86_64.rpm                                                                             | 104 kB  00:00:00     
(2/27): apr-util-1.5.2-6.el7.x86_64.rpm                                                                        |  92 kB  00:00:00     
(3/27): gdbm-devel-1.10-8.el7.x86_64.rpm                                                                       |  47 kB  00:00:00     
(4/27): glibc-2.17-325.el7_9.x86_64.rpm                                                                        | 3.6 MB  00:00:00     
(5/27): glibc-common-2.17-325.el7_9.x86_64.rpm                                                                 |  12 MB  00:00:00     
(6/27): glibc-devel-2.17-325.el7_9.x86_64.rpm                                                                  | 1.1 MB  00:00:00     
(7/27): glibc-headers-2.17-325.el7_9.x86_64.rpm                                                                | 691 kB  00:00:00     
(8/27): httpd-manual-2.4.6-97.el7.centos.2.noarch.rpm                                                          | 1.3 MB  00:00:00     
(9/27): httpd-2.4.6-97.el7.centos.2.x86_64.rpm                                                                 | 2.7 MB  00:00:00     
(10/27): httpd-tools-2.4.6-97.el7.centos.2.x86_64.rpm                                                          |  94 kB  00:00:00     
(11/27): mod_ssl-2.4.6-97.el7.centos.2.x86_64.rpm                                                              | 115 kB  00:00:00     
(12/27): nscd-2.17-325.el7_9.x86_64.rpm                                                                        | 289 kB  00:00:00     
(13/27): perl-BSD-Resource-1.29.07-1.el7.x86_64.rpm                                                            |  38 kB  00:00:00     
(14/27): mailcap-2.1.41-2.el7.noarch.rpm                                                                       |  31 kB  00:00:00     
(15/27): perl-Data-Dumper-2.145-3.el7.x86_64.rpm                                                               |  47 kB  00:00:00     
(16/27): libdb-devel-5.3.21-25.el7.x86_64.rpm                                                                  |  39 kB  00:00:00     
(17/27): perl-ExtUtils-MakeMaker-6.68-3.el7.noarch.rpm                                                         | 275 kB  00:00:00     
(18/27): perl-ExtUtils-ParseXS-3.18-3.el7.noarch.rpm                                                           |  77 kB  00:00:00     
(19/27): kernel-headers-3.10.0-1160.53.1.el7.x86_64.rpm                                                        | 9.0 MB  00:00:00     
(20/27): perl-Linux-Pid-0.04-18.el7.x86_64.rpm                                                                 |  14 kB  00:00:00     
(21/27): perl-ExtUtils-Install-1.58-299.el7_9.noarch.rpm                                                       |  75 kB  00:00:00     
(22/27): perl-ExtUtils-Manifest-1.61-244.el7.noarch.rpm                                                        |  31 kB  00:00:00     
(23/27): pyparsing-1.5.6-9.el7.noarch.rpm                                                                      |  94 kB  00:00:00     
(24/27): systemtap-sdt-devel-4.0-13.el7.x86_64.rpm                                                             |  76 kB  00:00:00     
(25/27): perl-Test-Harness-3.28-3.el7.noarch.rpm                                                               | 302 kB  00:00:00     
(26/27): mod_perl-2.0.11-1.el7.x86_64.rpm                                                                      | 3.0 MB  00:00:00     
(27/27): perl-devel-5.16.3-299.el7_9.x86_64.rpm                                                                | 454 kB  00:00:00     
--------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                  32 MB/s |  35 MB  00:00:01     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : glibc-2.17-325.el7_9.x86_64                                                                                       1/30 
  Updating   : glibc-common-2.17-325.el7_9.x86_64                                                                                2/30 
  Installing : apr-1.4.8-7.el7.x86_64                                                                                            3/30 
  Installing : apr-util-1.5.2-6.el7.x86_64                                                                                       4/30 
  Installing : httpd-tools-2.4.6-97.el7.centos.2.x86_64                                                                          5/30 
  Installing : perl-BSD-Resource-1.29.07-1.el7.x86_64                                                                            6/30 
  Installing : perl-Linux-Pid-0.04-18.el7.x86_64                                                                                 7/30 
  Installing : perl-Data-Dumper-2.145-3.el7.x86_64                                                                               8/30 
  Installing : libdb-devel-5.3.21-25.el7.x86_64                                                                                  9/30 
  Installing : perl-Test-Harness-3.28-3.el7.noarch                                                                              10/30 
  Installing : gdbm-devel-1.10-8.el7.x86_64                                                                                     11/30 
  Installing : pyparsing-1.5.6-9.el7.noarch                                                                                     12/30 
  Installing : systemtap-sdt-devel-4.0-13.el7.x86_64                                                                            13/30 
  Installing : kernel-headers-3.10.0-1160.53.1.el7.x86_64                                                                       14/30 
  Installing : glibc-headers-2.17-325.el7_9.x86_64                                                                              15/30 
  Installing : glibc-devel-2.17-325.el7_9.x86_64                                                                                16/30 
  Installing : perl-ExtUtils-Manifest-1.61-244.el7.noarch                                                                       17/30 
  Installing : perl-ExtUtils-MakeMaker-6.68-3.el7.noarch                                                                        18/30 
  Installing : 1:perl-ExtUtils-ParseXS-3.18-3.el7.noarch                                                                        19/30 
  Installing : 4:perl-devel-5.16.3-299.el7_9.x86_64                                                                             20/30 
  Installing : perl-ExtUtils-Install-1.58-299.el7_9.noarch                                                                      21/30 
  Installing : mailcap-2.1.41-2.el7.noarch                                                                                      22/30 
  Installing : httpd-2.4.6-97.el7.centos.2.x86_64                                                                               23/30 
  Installing : mod_perl-2.0.11-1.el7.x86_64                                                                                     24/30 
  Installing : httpd-manual-2.4.6-97.el7.centos.2.noarch                                                                        25/30 
  Installing : 1:mod_ssl-2.4.6-97.el7.centos.2.x86_64                                                                           26/30 
  Updating   : nscd-2.17-325.el7_9.x86_64                                                                                       27/30 
  Cleanup    : nscd-2.17-292.el7.x86_64                                                                                         28/30 
  Cleanup    : glibc-2.17-292.el7.x86_64                                                                                        29/30 
  Cleanup    : glibc-common-2.17-292.el7.x86_64                                                                                 30/30 
  Verifying  : perl-BSD-Resource-1.29.07-1.el7.x86_64                                                                            1/30 
  Verifying  : mailcap-2.1.41-2.el7.noarch                                                                                       2/30 
  Verifying  : perl-ExtUtils-Install-1.58-299.el7_9.noarch                                                                       3/30 
  Verifying  : perl-ExtUtils-Manifest-1.61-244.el7.noarch                                                                        4/30 
  Verifying  : kernel-headers-3.10.0-1160.53.1.el7.x86_64                                                                        5/30 
  Verifying  : 1:perl-ExtUtils-ParseXS-3.18-3.el7.noarch                                                                         6/30 
  Verifying  : pyparsing-1.5.6-9.el7.noarch                                                                                      7/30 
  Verifying  : gdbm-devel-1.10-8.el7.x86_64                                                                                      8/30 
  Verifying  : perl-ExtUtils-MakeMaker-6.68-3.el7.noarch                                                                         9/30 
  Verifying  : mod_perl-2.0.11-1.el7.x86_64                                                                                     10/30 
  Verifying  : httpd-2.4.6-97.el7.centos.2.x86_64                                                                               11/30 
  Verifying  : perl-Test-Harness-3.28-3.el7.noarch                                                                              12/30 
  Verifying  : apr-1.4.8-7.el7.x86_64                                                                                           13/30 
  Verifying  : glibc-devel-2.17-325.el7_9.x86_64                                                                                14/30 
  Verifying  : systemtap-sdt-devel-4.0-13.el7.x86_64                                                                            15/30 
  Verifying  : glibc-headers-2.17-325.el7_9.x86_64                                                                              16/30 
  Verifying  : httpd-manual-2.4.6-97.el7.centos.2.noarch                                                                        17/30 
  Verifying  : glibc-common-2.17-325.el7_9.x86_64                                                                               18/30 
  Verifying  : nscd-2.17-325.el7_9.x86_64                                                                                       19/30 
  Verifying  : libdb-devel-5.3.21-25.el7.x86_64                                                                                 20/30 
  Verifying  : 4:perl-devel-5.16.3-299.el7_9.x86_64                                                                             21/30 
  Verifying  : perl-Linux-Pid-0.04-18.el7.x86_64                                                                                22/30 
  Verifying  : httpd-tools-2.4.6-97.el7.centos.2.x86_64                                                                         23/30 
  Verifying  : perl-Data-Dumper-2.145-3.el7.x86_64                                                                              24/30 
  Verifying  : apr-util-1.5.2-6.el7.x86_64                                                                                      25/30 
  Verifying  : glibc-2.17-325.el7_9.x86_64                                                                                      26/30 
  Verifying  : 1:mod_ssl-2.4.6-97.el7.centos.2.x86_64                                                                           27/30 
  Verifying  : glibc-common-2.17-292.el7.x86_64                                                                                 28/30 
  Verifying  : nscd-2.17-292.el7.x86_64                                                                                         29/30 
  Verifying  : glibc-2.17-292.el7.x86_64                                                                                        30/30 

Installed:
  httpd.x86_64 0:2.4.6-97.el7.centos.2         httpd-manual.noarch 0:2.4.6-97.el7.centos.2       mod_perl.x86_64 0:2.0.11-1.el7      
  mod_ssl.x86_64 1:2.4.6-97.el7.centos.2      

Dependency Installed:
  apr.x86_64 0:1.4.8-7.el7                                          apr-util.x86_64 0:1.5.2-6.el7                                     
  gdbm-devel.x86_64 0:1.10-8.el7                                    glibc-devel.x86_64 0:2.17-325.el7_9                               
  glibc-headers.x86_64 0:2.17-325.el7_9                             httpd-tools.x86_64 0:2.4.6-97.el7.centos.2                        
  kernel-headers.x86_64 0:3.10.0-1160.53.1.el7                      libdb-devel.x86_64 0:5.3.21-25.el7                                
  mailcap.noarch 0:2.1.41-2.el7                                     perl-BSD-Resource.x86_64 0:1.29.07-1.el7                          
  perl-Data-Dumper.x86_64 0:2.145-3.el7                             perl-ExtUtils-Install.noarch 0:1.58-299.el7_9                     
  perl-ExtUtils-MakeMaker.noarch 0:6.68-3.el7                       perl-ExtUtils-Manifest.noarch 0:1.61-244.el7                      
  perl-ExtUtils-ParseXS.noarch 1:3.18-3.el7                         perl-Linux-Pid.x86_64 0:0.04-18.el7                               
  perl-Test-Harness.noarch 0:3.28-3.el7                             perl-devel.x86_64 4:5.16.3-299.el7_9                              
  pyparsing.noarch 0:1.5.6-9.el7                                    systemtap-sdt-devel.x86_64 0:4.0-13.el7                           

Dependency Updated:
  glibc.x86_64 0:2.17-325.el7_9             glibc-common.x86_64 0:2.17-325.el7_9             nscd.x86_64 0:2.17-325.el7_9            

Complete!
  1. 执行如下命令,启动Apache服务。
systemctl start httpd.service
  1. 在本地电脑的浏览器的址栏中,输入ECS公网登录地址,并按Enter键。
若返回页面如下图所示,说明Apache服务启动成功。

学习报告:冬季实战营第一期

三、安装并配置MySQL

MySQL是最流行的关系型数据库管理系统,在WEB应用方面MySQL是最好的 RDBMS(Relational Database Management System:关系数据库管理系统)应用软件之一。

  1. 执行以下命令(您可以一条一条执行),下载并安装MySQL官方的Yum Repository
rpm -e mariadb-libs --nodeps
yum install -y https://mirrors.aliyun.com/mysql/MySQL-5.7/mysql-community-common-5.7.35-1.el7.x86_64.rpm
yum install -y https://mirrors.aliyun.com/mysql/MySQL-5.7/mysql-community-libs-5.7.35-1.el7.x86_64.rpm
yum install -y https://mirrors.aliyun.com/mysql/MySQL-5.7/mysql-community-libs-compat-5.7.35-1.el7.x86_64.rpm
yum install -y https://mirrors.aliyun.com/mysql/MySQL-5.7/mysql-community-client-5.7.35-1.el7.x86_64.rpm
yum install -y https://mirrors.aliyun.com/mysql/MySQL-5.7/mysql-community-server-5.7.35-1.el7.x86_64.rpm
  1. 运行以下命令查看MySQL版本号。
mysql -V
返回结果如下所示,表示MySQL安装成功。
[root@iZuf68ebyms359ziewcgnaZ ~]# mysql -V
mysql  Ver 14.14 Distrib 5.7.35, for Linux (x86_64) using  EditLine wrapper
  1. 执行以下命令,启动 MySQL 数据库。
systemctl start mysqld.service
  1. 执行以下命令,查看MySQL初始密码。
grep "password" /var/log/mysqld.log

例如

[root@iZuf68ebyms359ziewcgnaZ ~]# grep "password" /var/log/mysqld.log
2022-01-25T11:48:37.740435Z 1 [Note] A temporary password is generated for root@localhost: ,eeF_H=1sniI         
  1. 执行以下命令,登录数据库。
mysql -uroot -p

例如

[root@iZuf68ebyms359ziewcgnaZ ~]# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
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> 
  1. 执行以下命令,修改MySQL默认密码。
set global validate_password_policy=0;  #修改密码安全策略为低(只校验密码长度,至少8位)。
ALTER USER 'root'@'localhost' IDENTIFIED BY '12345678';

例如:

mysql> set global validate_password_policy=0;
Query OK, 0 rows affected (0.00 sec)

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '12345678';
Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec) 表示有效输入

  1. 执行以下命令,授予root用户远程管理权限。
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '12345678';

例如

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '12345678';
Query OK, 0 rows affected, 1 warning (0.00 sec)
  1. 输入 exitquit 退出数据库。
mysql> exit
Bye
mysql> quit
Bye
  • 在以前的版本是有区别的,exit是先提交数据在退出,而quit是直接退出。
  • 现在的版本没有区别,都下是先commit,在退出。

四、安装PHP

PHP(PHP:Hypertext Preprocessor递归缩写)中文名字是:“超文本预处理器”,是一种广泛使用的通用开源脚本语言,适合于Web网站开发,它可以嵌入HTML中。编程范型是面向对象、命令式编程的。

  1. 执行以下下命令,安装PHP环境。
yum -y install php php-mysql gd php-gd gd-devel php-xml php-common php-mbstring php-ldap php-pear php-xmlrpc php-imap

例如

[root@iZuf68ebyms359ziewcgnaZ ~]# yum -y install php php-mysql gd php-gd gd-devel php-xml php-common php-mbstring php-ldap php-pear php-xmlrpc php-imap
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package gd.x86_64 0:2.0.35-27.el7_9 will be installed
--> Processing Dependency: libjpeg.so.62(LIBJPEG_6.2)(64bit) for package: gd-2.0.35-27.el7_9.x86_64
--> Processing Dependency: libjpeg.so.62()(64bit) for package: gd-2.0.35-27.el7_9.x86_64
--> Processing Dependency: libfontconfig.so.1()(64bit) for package: gd-2.0.35-27.el7_9.x86_64
--> Processing Dependency: libXpm.so.4()(64bit) for package: gd-2.0.35-27.el7_9.x86_64
--> Processing Dependency: libX11.so.6()(64bit) for package: gd-2.0.35-27.el7_9.x86_64
---> Package gd-devel.x86_64 0:2.0.35-27.el7_9 will be installed
--> Processing Dependency: zlib-devel for package: gd-devel-2.0.35-27.el7_9.x86_64
--> Processing Dependency: libpng-devel for package: gd-devel-2.0.35-27.el7_9.x86_64
--> Processing Dependency: libjpeg-devel for package: gd-devel-2.0.35-27.el7_9.x86_64
--> Processing Dependency: libXpm-devel for package: gd-devel-2.0.35-27.el7_9.x86_64
--> Processing Dependency: libX11-devel for package: gd-devel-2.0.35-27.el7_9.x86_64
--> Processing Dependency: freetype-devel for package: gd-devel-2.0.35-27.el7_9.x86_64
--> Processing Dependency: fontconfig-devel for package: gd-devel-2.0.35-27.el7_9.x86_64
---> Package php.x86_64 0:5.4.16-48.el7 will be installed
--> Processing Dependency: php-cli(x86-64) = 5.4.16-48.el7 for package: php-5.4.16-48.el7.x86_64
---> Package php-common.x86_64 0:5.4.16-48.el7 will be installed
--> Processing Dependency: libzip.so.2()(64bit) for package: php-common-5.4.16-48.el7.x86_64
---> Package php-gd.x86_64 0:5.4.16-48.el7 will be installed
--> Processing Dependency: libt1.so.5()(64bit) for package: php-gd-5.4.16-48.el7.x86_64
---> Package php-imap.x86_64 0:5.4.16-9.el7 will be installed
--> Processing Dependency: libc-client.so.2007()(64bit) for package: php-imap-5.4.16-9.el7.x86_64
---> Package php-ldap.x86_64 0:5.4.16-48.el7 will be installed
---> Package php-mbstring.x86_64 0:5.4.16-48.el7 will be installed
---> Package php-mysql.x86_64 0:5.4.16-48.el7 will be installed
--> Processing Dependency: php-pdo(x86-64) = 5.4.16-48.el7 for package: php-mysql-5.4.16-48.el7.x86_64
---> Package php-pear.noarch 1:1.9.4-22.el7 will be installed
--> Processing Dependency: php-posix for package: 1:php-pear-1.9.4-22.el7.noarch
---> Package php-xml.x86_64 0:5.4.16-48.el7 will be installed
--> Processing Dependency: libxslt.so.1(LIBXML2_1.0.24)(64bit) for package: php-xml-5.4.16-48.el7.x86_64
--> Processing Dependency: libxslt.so.1(LIBXML2_1.0.22)(64bit) for package: php-xml-5.4.16-48.el7.x86_64
--> Processing Dependency: libxslt.so.1(LIBXML2_1.0.18)(64bit) for package: php-xml-5.4.16-48.el7.x86_64
--> Processing Dependency: libxslt.so.1(LIBXML2_1.0.13)(64bit) for package: php-xml-5.4.16-48.el7.x86_64
--> Processing Dependency: libxslt.so.1(LIBXML2_1.0.11)(64bit) for package: php-xml-5.4.16-48.el7.x86_64
--> Processing Dependency: libxslt.so.1()(64bit) for package: php-xml-5.4.16-48.el7.x86_64
--> Processing Dependency: libexslt.so.0()(64bit) for package: php-xml-5.4.16-48.el7.x86_64
---> Package php-xmlrpc.x86_64 0:5.4.16-48.el7 will be installed
--> Running transaction check
---> Package fontconfig.x86_64 0:2.13.0-4.3.el7 will be installed
--> Processing Dependency: fontpackages-filesystem for package: fontconfig-2.13.0-4.3.el7.x86_64
--> Processing Dependency: dejavu-sans-fonts for package: fontconfig-2.13.0-4.3.el7.x86_64
---> Package fontconfig-devel.x86_64 0:2.13.0-4.3.el7 will be installed
--> Processing Dependency: pkgconfig(uuid) for package: fontconfig-devel-2.13.0-4.3.el7.x86_64
--> Processing Dependency: pkgconfig(expat) for package: fontconfig-devel-2.13.0-4.3.el7.x86_64
---> Package freetype-devel.x86_64 0:2.8-14.el7_9.1 will be installed
--> Processing Dependency: freetype = 2.8-14.el7_9.1 for package: freetype-devel-2.8-14.el7_9.1.x86_64
---> Package libX11.x86_64 0:1.6.7-4.el7_9 will be installed
--> Processing Dependency: libX11-common >= 1.6.7-4.el7_9 for package: libX11-1.6.7-4.el7_9.x86_64
--> Processing Dependency: libxcb.so.1()(64bit) for package: libX11-1.6.7-4.el7_9.x86_64
---> Package libX11-devel.x86_64 0:1.6.7-4.el7_9 will be installed
--> Processing Dependency: pkgconfig(xcb) >= 1.11.1 for package: libX11-devel-1.6.7-4.el7_9.x86_64
--> Processing Dependency: pkgconfig(xproto) for package: libX11-devel-1.6.7-4.el7_9.x86_64
--> Processing Dependency: pkgconfig(xcb) for package: libX11-devel-1.6.7-4.el7_9.x86_64
--> Processing Dependency: pkgconfig(kbproto) for package: libX11-devel-1.6.7-4.el7_9.x86_64
---> Package libXpm.x86_64 0:3.5.12-1.el7 will be installed
---> Package libXpm-devel.x86_64 0:3.5.12-1.el7 will be installed
--> Processing Dependency: libXt.so.6()(64bit) for package: libXpm-devel-3.5.12-1.el7.x86_64
--> Processing Dependency: libXext.so.6()(64bit) for package: libXpm-devel-3.5.12-1.el7.x86_64
---> Package libc-client.x86_64 0:2007f-16.el7 will be installed
---> Package libjpeg-turbo.x86_64 0:1.2.90-8.el7 will be installed
---> Package libjpeg-turbo-devel.x86_64 0:1.2.90-8.el7 will be installed
---> Package libpng-devel.x86_64 2:1.5.13-8.el7 will be installed
--> Processing Dependency: libpng(x86-64) = 2:1.5.13-8.el7 for package: 2:libpng-devel-1.5.13-8.el7.x86_64
---> Package libxslt.x86_64 0:1.1.28-6.el7 will be installed
---> Package libzip.x86_64 0:0.10.1-8.el7 will be installed
---> Package php-cli.x86_64 0:5.4.16-48.el7 will be installed
---> Package php-pdo.x86_64 0:5.4.16-48.el7 will be installed
---> Package php-process.x86_64 0:5.4.16-48.el7 will be installed
---> Package t1lib.x86_64 0:5.1.2-14.el7 will be installed
---> Package zlib-devel.x86_64 0:1.2.7-19.el7_9 will be installed
--> Processing Dependency: zlib = 1.2.7-19.el7_9 for package: zlib-devel-1.2.7-19.el7_9.x86_64
--> Running transaction check
---> Package dejavu-sans-fonts.noarch 0:2.33-6.el7 will be installed
--> Processing Dependency: dejavu-fonts-common = 2.33-6.el7 for package: dejavu-sans-fonts-2.33-6.el7.noarch
---> Package expat-devel.x86_64 0:2.1.0-12.el7 will be installed
--> Processing Dependency: expat = 2.1.0-12.el7 for package: expat-devel-2.1.0-12.el7.x86_64
---> Package fontpackages-filesystem.noarch 0:1.44-8.el7 will be installed
---> Package freetype.x86_64 0:2.8-14.el7 will be updated
---> Package freetype.x86_64 0:2.8-14.el7_9.1 will be an update
---> Package libX11-common.noarch 0:1.6.7-4.el7_9 will be installed
---> Package libXext.x86_64 0:1.3.3-3.el7 will be installed
---> Package libXt.x86_64 0:1.1.5-3.el7 will be installed
--> Processing Dependency: libSM.so.6()(64bit) for package: libXt-1.1.5-3.el7.x86_64
--> Processing Dependency: libICE.so.6()(64bit) for package: libXt-1.1.5-3.el7.x86_64
---> Package libpng.x86_64 2:1.5.13-7.el7_2 will be updated
---> Package libpng.x86_64 2:1.5.13-8.el7 will be an update
---> Package libuuid-devel.x86_64 0:2.23.2-65.el7_9.1 will be installed
--> Processing Dependency: libuuid = 2.23.2-65.el7_9.1 for package: libuuid-devel-2.23.2-65.el7_9.1.x86_64
---> Package libxcb.x86_64 0:1.13-1.el7 will be installed
--> Processing Dependency: libXau.so.6()(64bit) for package: libxcb-1.13-1.el7.x86_64
---> Package libxcb-devel.x86_64 0:1.13-1.el7 will be installed
--> Processing Dependency: pkgconfig(xau) >= 0.99.2 for package: libxcb-devel-1.13-1.el7.x86_64
---> Package xorg-x11-proto-devel.noarch 0:2018.4-1.el7 will be installed
---> Package zlib.x86_64 0:1.2.7-18.el7 will be updated
---> Package zlib.x86_64 0:1.2.7-19.el7_9 will be an update
--> Running transaction check
---> Package dejavu-fonts-common.noarch 0:2.33-6.el7 will be installed
---> Package expat.x86_64 0:2.1.0-10.el7_3 will be updated
---> Package expat.x86_64 0:2.1.0-12.el7 will be an update
---> Package libICE.x86_64 0:1.0.9-9.el7 will be installed
---> Package libSM.x86_64 0:1.2.2-2.el7 will be installed
---> Package libXau.x86_64 0:1.0.8-2.1.el7 will be installed
---> Package libXau-devel.x86_64 0:1.0.8-2.1.el7 will be installed
---> Package libuuid.x86_64 0:2.23.2-61.el7_7.1 will be updated
--> Processing Dependency: libuuid = 2.23.2-61.el7_7.1 for package: libblkid-2.23.2-61.el7_7.1.x86_64
--> Processing Dependency: libuuid = 2.23.2-61.el7_7.1 for package: libmount-2.23.2-61.el7_7.1.x86_64
--> Processing Dependency: libuuid = 2.23.2-61.el7_7.1 for package: util-linux-2.23.2-61.el7_7.1.x86_64
---> Package libuuid.x86_64 0:2.23.2-65.el7_9.1 will be an update
--> Running transaction check
---> Package libblkid.x86_64 0:2.23.2-61.el7_7.1 will be updated
---> Package libblkid.x86_64 0:2.23.2-65.el7_9.1 will be an update
---> Package libmount.x86_64 0:2.23.2-61.el7_7.1 will be updated
---> Package libmount.x86_64 0:2.23.2-65.el7_9.1 will be an update
---> Package util-linux.x86_64 0:2.23.2-61.el7_7.1 will be updated
---> Package util-linux.x86_64 0:2.23.2-65.el7_9.1 will be an update
--> Processing Dependency: libsmartcols = 2.23.2-65.el7_9.1 for package: util-linux-2.23.2-65.el7_9.1.x86_64
--> Running transaction check
---> Package libsmartcols.x86_64 0:2.23.2-61.el7_7.1 will be updated
---> Package libsmartcols.x86_64 0:2.23.2-65.el7_9.1 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

==================================================================================================================================
 Package                                 Arch                   Version                             Repository               Size
==================================================================================================================================
Installing:
 gd                                      x86_64                 2.0.35-27.el7_9                     updates                 146 k
 gd-devel                                x86_64                 2.0.35-27.el7_9                     updates                  79 k
 php                                     x86_64                 5.4.16-48.el7                       base                    1.4 M
 php-common                              x86_64                 5.4.16-48.el7                       base                    565 k
 php-gd                                  x86_64                 5.4.16-48.el7                       base                    128 k
 php-imap                                x86_64                 5.4.16-9.el7                        epel                     38 k
 php-ldap                                x86_64                 5.4.16-48.el7                       base                     53 k
 php-mbstring                            x86_64                 5.4.16-48.el7                       base                    506 k
 php-mysql                               x86_64                 5.4.16-48.el7                       base                    102 k
 php-pear                                noarch                 1:1.9.4-22.el7                      base                    357 k
 php-xml                                 x86_64                 5.4.16-48.el7                       base                    126 k
 php-xmlrpc                              x86_64                 5.4.16-48.el7                       base                     69 k
Installing for dependencies:
 dejavu-fonts-common                     noarch                 2.33-6.el7                          base                     64 k
 dejavu-sans-fonts                       noarch                 2.33-6.el7                          base                    1.4 M
 expat-devel                             x86_64                 2.1.0-12.el7                        base                     57 k
 fontconfig                              x86_64                 2.13.0-4.3.el7                      base                    254 k
 fontconfig-devel                        x86_64                 2.13.0-4.3.el7                      base                    138 k
 fontpackages-filesystem                 noarch                 1.44-8.el7                          base                    9.9 k
 freetype-devel                          x86_64                 2.8-14.el7_9.1                      updates                 447 k
 libICE                                  x86_64                 1.0.9-9.el7                         base                     66 k
 libSM                                   x86_64                 1.2.2-2.el7                         base                     39 k
 libX11                                  x86_64                 1.6.7-4.el7_9                       updates                 607 k
 libX11-common                           noarch                 1.6.7-4.el7_9                       updates                 164 k
 libX11-devel                            x86_64                 1.6.7-4.el7_9                       updates                 981 k
 libXau                                  x86_64                 1.0.8-2.1.el7                       base                     29 k
 libXau-devel                            x86_64                 1.0.8-2.1.el7                       base                     14 k
 libXext                                 x86_64                 1.3.3-3.el7                         base                     39 k
 libXpm                                  x86_64                 3.5.12-1.el7                        base                     55 k
 libXpm-devel                            x86_64                 3.5.12-1.el7                        base                     36 k
 libXt                                   x86_64                 1.1.5-3.el7                         base                    173 k
 libc-client                             x86_64                 2007f-16.el7                        epel                    562 k
 libjpeg-turbo                           x86_64                 1.2.90-8.el7                        base                    135 k
 libjpeg-turbo-devel                     x86_64                 1.2.90-8.el7                        base                     99 k
 libpng-devel                            x86_64                 2:1.5.13-8.el7                      base                    122 k
 libuuid-devel                           x86_64                 2.23.2-65.el7_9.1                   updates                  93 k
 libxcb                                  x86_64                 1.13-1.el7                          base                    214 k
 libxcb-devel                            x86_64                 1.13-1.el7                          base                    1.1 M
 libxslt                                 x86_64                 1.1.28-6.el7                        base                    242 k
 libzip                                  x86_64                 0.10.1-8.el7                        base                     48 k
 php-cli                                 x86_64                 5.4.16-48.el7                       base                    2.7 M
 php-pdo                                 x86_64                 5.4.16-48.el7                       base                     99 k
 php-process                             x86_64                 5.4.16-48.el7                       base                     56 k
 t1lib                                   x86_64                 5.1.2-14.el7                        base                    166 k
 xorg-x11-proto-devel                    noarch                 2018.4-1.el7                        base                    280 k
 zlib-devel                              x86_64                 1.2.7-19.el7_9                      updates                  50 k
Updating for dependencies:
 expat                                   x86_64                 2.1.0-12.el7                        base                     81 k
 freetype                                x86_64                 2.8-14.el7_9.1                      updates                 380 k
 libblkid                                x86_64                 2.23.2-65.el7_9.1                   updates                 183 k
 libmount                                x86_64                 2.23.2-65.el7_9.1                   updates                 185 k
 libpng                                  x86_64                 2:1.5.13-8.el7                      base                    213 k
 libsmartcols                            x86_64                 2.23.2-65.el7_9.1                   updates                 143 k
 libuuid                                 x86_64                 2.23.2-65.el7_9.1                   updates                  84 k
 util-linux                              x86_64                 2.23.2-65.el7_9.1                   updates                 2.0 M
 zlib                                    x86_64                 1.2.7-19.el7_9                      updates                  90 k

Transaction Summary
==================================================================================================================================
Install  12 Packages (+33 Dependent packages)
Upgrade              (  9 Dependent packages)

Total download size: 17 M
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(1/54): dejavu-fonts-common-2.33-6.el7.noarch.rpm                                                          |  64 kB  00:00:00     
(2/54): expat-2.1.0-12.el7.x86_64.rpm                                                                      |  81 kB  00:00:00     
(3/54): expat-devel-2.1.0-12.el7.x86_64.rpm                                                                |  57 kB  00:00:00     
(4/54): dejavu-sans-fonts-2.33-6.el7.noarch.rpm                                                            | 1.4 MB  00:00:00     
(5/54): fontconfig-2.13.0-4.3.el7.x86_64.rpm                                                               | 254 kB  00:00:00     
(6/54): fontpackages-filesystem-1.44-8.el7.noarch.rpm                                                      | 9.9 kB  00:00:00     
(7/54): fontconfig-devel-2.13.0-4.3.el7.x86_64.rpm                                                         | 138 kB  00:00:00     
(8/54): freetype-2.8-14.el7_9.1.x86_64.rpm                                                                 | 380 kB  00:00:00     
(9/54): freetype-devel-2.8-14.el7_9.1.x86_64.rpm                                                           | 447 kB  00:00:00     
(10/54): gd-2.0.35-27.el7_9.x86_64.rpm                                                                     | 146 kB  00:00:00     
(11/54): gd-devel-2.0.35-27.el7_9.x86_64.rpm                                                               |  79 kB  00:00:00     
(12/54): libX11-1.6.7-4.el7_9.x86_64.rpm                                                                   | 607 kB  00:00:00     
(13/54): libX11-common-1.6.7-4.el7_9.noarch.rpm                                                            | 164 kB  00:00:00     
(14/54): libSM-1.2.2-2.el7.x86_64.rpm                                                                      |  39 kB  00:00:00     
(15/54): libICE-1.0.9-9.el7.x86_64.rpm                                                                     |  66 kB  00:00:00     
(16/54): libXau-1.0.8-2.1.el7.x86_64.rpm                                                                   |  29 kB  00:00:00     
(17/54): libXau-devel-1.0.8-2.1.el7.x86_64.rpm                                                             |  14 kB  00:00:00     
(18/54): libXext-1.3.3-3.el7.x86_64.rpm                                                                    |  39 kB  00:00:00     
(19/54): libXpm-3.5.12-1.el7.x86_64.rpm                                                                    |  55 kB  00:00:00     
(20/54): libXpm-devel-3.5.12-1.el7.x86_64.rpm                                                              |  36 kB  00:00:00     
(21/54): libXt-1.1.5-3.el7.x86_64.rpm                                                                      | 173 kB  00:00:00     
(22/54): libjpeg-turbo-1.2.90-8.el7.x86_64.rpm                                                             | 135 kB  00:00:00     
(23/54): libjpeg-turbo-devel-1.2.90-8.el7.x86_64.rpm                                                       |  99 kB  00:00:00     
(24/54): libX11-devel-1.6.7-4.el7_9.x86_64.rpm                                                             | 981 kB  00:00:00     
(25/54): libblkid-2.23.2-65.el7_9.1.x86_64.rpm                                                             | 183 kB  00:00:00     
(26/54): libmount-2.23.2-65.el7_9.1.x86_64.rpm                                                             | 185 kB  00:00:00     
(27/54): libuuid-2.23.2-65.el7_9.1.x86_64.rpm                                                              |  84 kB  00:00:00     
(28/54): libc-client-2007f-16.el7.x86_64.rpm                                                               | 562 kB  00:00:00     
(29/54): libuuid-devel-2.23.2-65.el7_9.1.x86_64.rpm                                                        |  93 kB  00:00:00     
(30/54): libpng-devel-1.5.13-8.el7.x86_64.rpm                                                              | 122 kB  00:00:00     
(31/54): libpng-1.5.13-8.el7.x86_64.rpm                                                                    | 213 kB  00:00:00     
(32/54): libxcb-1.13-1.el7.x86_64.rpm                                                                      | 214 kB  00:00:00     
(33/54): libsmartcols-2.23.2-65.el7_9.1.x86_64.rpm                                                         | 143 kB  00:00:00     
(34/54): libxslt-1.1.28-6.el7.x86_64.rpm                                                                   | 242 kB  00:00:00     
(35/54): libzip-0.10.1-8.el7.x86_64.rpm                                                                    |  48 kB  00:00:00     
(36/54): libxcb-devel-1.13-1.el7.x86_64.rpm                                                                | 1.1 MB  00:00:00     
(37/54): php-5.4.16-48.el7.x86_64.rpm                                                                      | 1.4 MB  00:00:00     
(38/54): php-cli-5.4.16-48.el7.x86_64.rpm                                                                  | 2.7 MB  00:00:00     
(39/54): php-common-5.4.16-48.el7.x86_64.rpm                                                               | 565 kB  00:00:00     
(40/54): php-gd-5.4.16-48.el7.x86_64.rpm                                                                   | 128 kB  00:00:00     
(41/54): php-ldap-5.4.16-48.el7.x86_64.rpm                                                                 |  53 kB  00:00:00     
(42/54): php-mysql-5.4.16-48.el7.x86_64.rpm                                                                | 102 kB  00:00:00     
(43/54): php-pdo-5.4.16-48.el7.x86_64.rpm                                                                  |  99 kB  00:00:00     
(44/54): php-pear-1.9.4-22.el7.noarch.rpm                                                                  | 357 kB  00:00:00     
(45/54): php-process-5.4.16-48.el7.x86_64.rpm                                                              |  56 kB  00:00:00     
(46/54): php-xml-5.4.16-48.el7.x86_64.rpm                                                                  | 126 kB  00:00:00     
(47/54): php-xmlrpc-5.4.16-48.el7.x86_64.rpm                                                               |  69 kB  00:00:00     
(48/54): php-imap-5.4.16-9.el7.x86_64.rpm                                                                  |  38 kB  00:00:00     
(49/54): t1lib-5.1.2-14.el7.x86_64.rpm                                                                     | 166 kB  00:00:00     
(50/54): xorg-x11-proto-devel-2018.4-1.el7.noarch.rpm                                                      | 280 kB  00:00:00     
(51/54): php-mbstring-5.4.16-48.el7.x86_64.rpm                                                             | 506 kB  00:00:00     
(52/54): zlib-1.2.7-19.el7_9.x86_64.rpm                                                                    |  90 kB  00:00:00     
(53/54): zlib-devel-1.2.7-19.el7_9.x86_64.rpm                                                              |  50 kB  00:00:00     
(54/54): util-linux-2.23.2-65.el7_9.1.x86_64.rpm                                                           | 2.0 MB  00:00:00     
----------------------------------------------------------------------------------------------------------------------------------
Total                                                                                              11 MB/s |  17 MB  00:00:01     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : zlib-1.2.7-19.el7_9.x86_64                                                                                    1/63 
  Updating   : libuuid-2.23.2-65.el7_9.1.x86_64                                                                              2/63 
  Updating   : 2:libpng-1.5.13-8.el7.x86_64                                                                                  3/63 
  Updating   : freetype-2.8-14.el7_9.1.x86_64                                                                                4/63 
  Installing : zlib-devel-1.2.7-19.el7_9.x86_64                                                                              5/63 
  Installing : libjpeg-turbo-1.2.90-8.el7.x86_64                                                                             6/63 
  Installing : 2:libpng-devel-1.5.13-8.el7.x86_64                                                                            7/63 
  Installing : freetype-devel-2.8-14.el7_9.1.x86_64                                                                          8/63 
  Updating   : libblkid-2.23.2-65.el7_9.1.x86_64                                                                             9/63 
  Installing : libICE-1.0.9-9.el7.x86_64                                                                                    10/63 
  Installing : libXau-1.0.8-2.1.el7.x86_64                                                                                  11/63 
  Installing : libxcb-1.13-1.el7.x86_64                                                                                     12/63 
  Installing : xorg-x11-proto-devel-2018.4-1.el7.noarch                                                                     13/63 
  Installing : fontpackages-filesystem-1.44-8.el7.noarch                                                                    14/63 
  Updating   : expat-2.1.0-12.el7.x86_64                                                                                    15/63 
  Installing : expat-devel-2.1.0-12.el7.x86_64                                                                              16/63 
  Installing : dejavu-fonts-common-2.33-6.el7.noarch                                                                        17/63 
  Installing : dejavu-sans-fonts-2.33-6.el7.noarch                                                                          18/63 
  Installing : fontconfig-2.13.0-4.3.el7.x86_64                                                                             19/63 
  Installing : libXau-devel-1.0.8-2.1.el7.x86_64                                                                            20/63 
  Installing : libxcb-devel-1.13-1.el7.x86_64                                                                               21/63 
  Installing : libSM-1.2.2-2.el7.x86_64                                                                                     22/63 
  Updating   : libmount-2.23.2-65.el7_9.1.x86_64                                                                            23/63 
  Installing : libjpeg-turbo-devel-1.2.90-8.el7.x86_64                                                                      24/63 
  Installing : libuuid-devel-2.23.2-65.el7_9.1.x86_64                                                                       25/63 
  Installing : fontconfig-devel-2.13.0-4.3.el7.x86_64                                                                       26/63 
  Installing : libxslt-1.1.28-6.el7.x86_64                                                                                  27/63 
  Installing : libzip-0.10.1-8.el7.x86_64                                                                                   28/63 
  Installing : php-common-5.4.16-48.el7.x86_64                                                                              29/63 
  Installing : php-cli-5.4.16-48.el7.x86_64                                                                                 30/63 
  Installing : php-process-5.4.16-48.el7.x86_64                                                                             31/63 
  Installing : php-xml-5.4.16-48.el7.x86_64                                                                                 32/63 
  Installing : php-pdo-5.4.16-48.el7.x86_64                                                                                 33/63 
  Installing : libX11-common-1.6.7-4.el7_9.noarch                                                                           34/63 
  Installing : libX11-1.6.7-4.el7_9.x86_64                                                                                  35/63 
  Installing : libXpm-3.5.12-1.el7.x86_64                                                                                   36/63 
  Installing : libX11-devel-1.6.7-4.el7_9.x86_64                                                                            37/63 
  Installing : gd-2.0.35-27.el7_9.x86_64                                                                                    38/63 
  Installing : libXext-1.3.3-3.el7.x86_64                                                                                   39/63 
  Installing : libXt-1.1.5-3.el7.x86_64                                                                                     40/63 
  Installing : libXpm-devel-3.5.12-1.el7.x86_64                                                                             41/63 
  Installing : t1lib-5.1.2-14.el7.x86_64                                                                                    42/63 
  Updating   : libsmartcols-2.23.2-65.el7_9.1.x86_64                                                                        43/63 
  Installing : libc-client-2007f-16.el7.x86_64                                                                              44/63 
  Installing : php-imap-5.4.16-9.el7.x86_64                                                                                 45/63 
  Updating   : util-linux-2.23.2-65.el7_9.1.x86_64                                                                          46/63 
  Installing : php-gd-5.4.16-48.el7.x86_64                                                                                  47/63 
  Installing : gd-devel-2.0.35-27.el7_9.x86_64                                                                              48/63 
  Installing : php-mysql-5.4.16-48.el7.x86_64                                                                               49/63 
  Installing : 1:php-pear-1.9.4-22.el7.noarch                                                                               50/63 
  Installing : php-5.4.16-48.el7.x86_64                                                                                     51/63 
  Installing : php-xmlrpc-5.4.16-48.el7.x86_64                                                                              52/63 
  Installing : php-ldap-5.4.16-48.el7.x86_64                                                                                53/63 
  Installing : php-mbstring-5.4.16-48.el7.x86_64                                                                            54/63 
  Cleanup    : util-linux-2.23.2-61.el7_7.1.x86_64                                                                          55/63 
  Cleanup    : libmount-2.23.2-61.el7_7.1.x86_64                                                                            56/63 
  Cleanup    : freetype-2.8-14.el7.x86_64                                                                                   57/63 
  Cleanup    : 2:libpng-1.5.13-7.el7_2.x86_64                                                                               58/63 
  Cleanup    : libblkid-2.23.2-61.el7_7.1.x86_64                                                                            59/63 
  Cleanup    : libuuid-2.23.2-61.el7_7.1.x86_64                                                                             60/63 
  Cleanup    : zlib-1.2.7-18.el7.x86_64                                                                                     61/63 
  Cleanup    : libsmartcols-2.23.2-61.el7_7.1.x86_64                                                                        62/63 
  Cleanup    : expat-2.1.0-10.el7_3.x86_64                                                                                  63/63 
  Verifying  : libXext-1.3.3-3.el7.x86_64                                                                                    1/63 
  Verifying  : 2:libpng-devel-1.5.13-8.el7.x86_64                                                                            2/63 
  Verifying  : php-xmlrpc-5.4.16-48.el7.x86_64                                                                               3/63 
  Verifying  : zlib-1.2.7-19.el7_9.x86_64                                                                                    4/63 
  Verifying  : libjpeg-turbo-1.2.90-8.el7.x86_64                                                                             5/63 
  Verifying  : php-process-5.4.16-48.el7.x86_64                                                                              6/63 
  Verifying  : libXt-1.1.5-3.el7.x86_64                                                                                      7/63 
  Verifying  : libjpeg-turbo-devel-1.2.90-8.el7.x86_64                                                                       8/63 
  Verifying  : php-imap-5.4.16-9.el7.x86_64                                                                                  9/63 
  Verifying  : expat-2.1.0-12.el7.x86_64                                                                                    10/63 
  Verifying  : libc-client-2007f-16.el7.x86_64                                                                              11/63 
  Verifying  : libmount-2.23.2-65.el7_9.1.x86_64                                                                            12/63 
  Verifying  : fontconfig-2.13.0-4.3.el7.x86_64                                                                             13/63 
  Verifying  : dejavu-fonts-common-2.33-6.el7.noarch                                                                        14/63 
  Verifying  : fontpackages-filesystem-1.44-8.el7.noarch                                                                    15/63 
  Verifying  : php-xml-5.4.16-48.el7.x86_64                                                                                 16/63 
  Verifying  : php-ldap-5.4.16-48.el7.x86_64                                                                                17/63 
  Verifying  : fontconfig-devel-2.13.0-4.3.el7.x86_64                                                                       18/63 
  Verifying  : libuuid-devel-2.23.2-65.el7_9.1.x86_64                                                                       19/63 
  Verifying  : xorg-x11-proto-devel-2018.4-1.el7.noarch                                                                     20/63 
  Verifying  : libXpm-devel-3.5.12-1.el7.x86_64                                                                             21/63 
  Verifying  : libX11-devel-1.6.7-4.el7_9.x86_64                                                                            22/63 
  Verifying  : libxcb-1.13-1.el7.x86_64                                                                                     23/63 
  Verifying  : libblkid-2.23.2-65.el7_9.1.x86_64                                                                            24/63 
  Verifying  : php-5.4.16-48.el7.x86_64                                                                                     25/63 
  Verifying  : libsmartcols-2.23.2-65.el7_9.1.x86_64                                                                        26/63 
  Verifying  : libXpm-3.5.12-1.el7.x86_64                                                                                   27/63 
  Verifying  : 1:php-pear-1.9.4-22.el7.noarch                                                                               28/63 
  Verifying  : t1lib-5.1.2-14.el7.x86_64                                                                                    29/63 
  Verifying  : php-pdo-5.4.16-48.el7.x86_64                                                                                 30/63 
  Verifying  : util-linux-2.23.2-65.el7_9.1.x86_64                                                                          31/63 
  Verifying  : gd-devel-2.0.35-27.el7_9.x86_64                                                                              32/63 
  Verifying  : php-cli-5.4.16-48.el7.x86_64                                                                                 33/63 
  Verifying  : php-mysql-5.4.16-48.el7.x86_64                                                                               34/63 
  Verifying  : zlib-devel-1.2.7-19.el7_9.x86_64                                                                             35/63 
  Verifying  : 2:libpng-1.5.13-8.el7.x86_64                                                                                 36/63 
  Verifying  : php-common-5.4.16-48.el7.x86_64                                                                              37/63 
  Verifying  : freetype-devel-2.8-14.el7_9.1.x86_64                                                                         38/63 
  Verifying  : gd-2.0.35-27.el7_9.x86_64                                                                                    39/63 
  Verifying  : expat-devel-2.1.0-12.el7.x86_64                                                                              40/63 
  Verifying  : libxcb-devel-1.13-1.el7.x86_64                                                                               41/63 
  Verifying  : dejavu-sans-fonts-2.33-6.el7.noarch                                                                          42/63 
  Verifying  : libXau-1.0.8-2.1.el7.x86_64                                                                                  43/63 
  Verifying  : libSM-1.2.2-2.el7.x86_64                                                                                     44/63 
  Verifying  : libxslt-1.1.28-6.el7.x86_64                                                                                  45/63 
  Verifying  : libX11-1.6.7-4.el7_9.x86_64                                                                                  46/63 
  Verifying  : php-mbstring-5.4.16-48.el7.x86_64                                                                            47/63 
  Verifying  : php-gd-5.4.16-48.el7.x86_64                                                                                  48/63 
  Verifying  : libuuid-2.23.2-65.el7_9.1.x86_64                                                                             49/63 
  Verifying  : libzip-0.10.1-8.el7.x86_64                                                                                   50/63 
  Verifying  : libICE-1.0.9-9.el7.x86_64                                                                                    51/63 
  Verifying  : freetype-2.8-14.el7_9.1.x86_64                                                                               52/63 
  Verifying  : libX11-common-1.6.7-4.el7_9.noarch                                                                           53/63 
  Verifying  : libXau-devel-1.0.8-2.1.el7.x86_64                                                                            54/63 
  Verifying  : 2:libpng-1.5.13-7.el7_2.x86_64                                                                               55/63 
  Verifying  : util-linux-2.23.2-61.el7_7.1.x86_64                                                                          56/63 
  Verifying  : zlib-1.2.7-18.el7.x86_64                                                                                     57/63 
  Verifying  : freetype-2.8-14.el7.x86_64                                                                                   58/63 
  Verifying  : libuuid-2.23.2-61.el7_7.1.x86_64                                                                             59/63 
  Verifying  : libmount-2.23.2-61.el7_7.1.x86_64                                                                            60/63 
  Verifying  : expat-2.1.0-10.el7_3.x86_64                                                                                  61/63 
  Verifying  : libsmartcols-2.23.2-61.el7_7.1.x86_64                                                                        62/63 
  Verifying  : libblkid-2.23.2-61.el7_7.1.x86_64                                                                            63/63 

Installed:
  gd.x86_64 0:2.0.35-27.el7_9               gd-devel.x86_64 0:2.0.35-27.el7_9           php.x86_64 0:5.4.16-48.el7               
  php-common.x86_64 0:5.4.16-48.el7         php-gd.x86_64 0:5.4.16-48.el7               php-imap.x86_64 0:5.4.16-9.el7           
  php-ldap.x86_64 0:5.4.16-48.el7           php-mbstring.x86_64 0:5.4.16-48.el7         php-mysql.x86_64 0:5.4.16-48.el7         
  php-pear.noarch 1:1.9.4-22.el7            php-xml.x86_64 0:5.4.16-48.el7              php-xmlrpc.x86_64 0:5.4.16-48.el7        

Dependency Installed:
  dejavu-fonts-common.noarch 0:2.33-6.el7 dejavu-sans-fonts.noarch 0:2.33-6.el7      expat-devel.x86_64 0:2.1.0-12.el7          
  fontconfig.x86_64 0:2.13.0-4.3.el7      fontconfig-devel.x86_64 0:2.13.0-4.3.el7   fontpackages-filesystem.noarch 0:1.44-8.el7
  freetype-devel.x86_64 0:2.8-14.el7_9.1  libICE.x86_64 0:1.0.9-9.el7                libSM.x86_64 0:1.2.2-2.el7                 
  libX11.x86_64 0:1.6.7-4.el7_9           libX11-common.noarch 0:1.6.7-4.el7_9       libX11-devel.x86_64 0:1.6.7-4.el7_9        
  libXau.x86_64 0:1.0.8-2.1.el7           libXau-devel.x86_64 0:1.0.8-2.1.el7        libXext.x86_64 0:1.3.3-3.el7               
  libXpm.x86_64 0:3.5.12-1.el7            libXpm-devel.x86_64 0:3.5.12-1.el7         libXt.x86_64 0:1.1.5-3.el7                 
  libc-client.x86_64 0:2007f-16.el7       libjpeg-turbo.x86_64 0:1.2.90-8.el7        libjpeg-turbo-devel.x86_64 0:1.2.90-8.el7  
  libpng-devel.x86_64 2:1.5.13-8.el7      libuuid-devel.x86_64 0:2.23.2-65.el7_9.1   libxcb.x86_64 0:1.13-1.el7                 
  libxcb-devel.x86_64 0:1.13-1.el7        libxslt.x86_64 0:1.1.28-6.el7              libzip.x86_64 0:0.10.1-8.el7               
  php-cli.x86_64 0:5.4.16-48.el7          php-pdo.x86_64 0:5.4.16-48.el7             php-process.x86_64 0:5.4.16-48.el7         
  t1lib.x86_64 0:5.1.2-14.el7             xorg-x11-proto-devel.noarch 0:2018.4-1.el7 zlib-devel.x86_64 0:1.2.7-19.el7_9         

Dependency Updated:
  expat.x86_64 0:2.1.0-12.el7              freetype.x86_64 0:2.8-14.el7_9.1           libblkid.x86_64 0:2.23.2-65.el7_9.1         
  libmount.x86_64 0:2.23.2-65.el7_9.1      libpng.x86_64 2:1.5.13-8.el7               libsmartcols.x86_64 0:2.23.2-65.el7_9.1     
  libuuid.x86_64 0:2.23.2-65.el7_9.1       util-linux.x86_64 0:2.23.2-65.el7_9.1      zlib.x86_64 0:1.2.7-19.el7_9                

Complete!
  1. 执行以下命令创建PHP测试页面。
echo "<?php phpinfo(); ?>" > /var/www/html/phpinfo.php
  1. 执行以下命令,重启Apache服务。
systemctl restart httpd
  1. 在本地浏览器的址栏中,,访问 http://<ECS公网IP>/phpinfo.php,显示如下页面表示PHP语言环境安装成功。

学习报告:冬季实战营第一期

五、安装phpMyAdmin

phpMyAdmin是一个MySQL数据库管理工具,通过Web接口管理数据库方便快捷。

  1. 执行以下命令,创建phpMyAdmin数据存放目录。
mkdir -p /var/www/html/phpmyadmin
  1. 执行以下命令,下载phpMyAdmin压缩包。
wget --no-check-certificate https://files.phpmyadmin.net/phpMyAdmin/4.0.10.20/phpMyAdmin-4.0.10.20-all-languages.zip

例如

[root@iZuf68ebyms359ziewcgnaZ ~]# wget --no-check-certificate https://files.phpmyadmin.net/phpMyAdmin/4.0.10.20/phpMyAdmin-4.0.10.20-all-languages.zip
--2022-01-25 20:07:04--  https://files.phpmyadmin.net/phpMyAdmin/4.0.10.20/phpMyAdmin-4.0.10.20-all-languages.zip
Resolving files.phpmyadmin.net (files.phpmyadmin.net)... 89.187.187.14, 2a02:6ea0:c800::8
Connecting to files.phpmyadmin.net (files.phpmyadmin.net)|89.187.187.14|:443... connected.
WARNING: cannot verify files.phpmyadmin.net's certificate, issued by ‘/C=US/O=Let's Encrypt/CN=R3’:
  Issued certificate has expired.
HTTP request sent, awaiting response... 200 OK
Length: 7457007 (7.1M) [application/zip]
Saving to: ‘phpMyAdmin-4.0.10.20-all-languages.zip’

100%[========================================================================================>] 7,457,007   1.19MB/s   in 7.4s   

2022-01-25 20:07:14 (990 KB/s) - ‘phpMyAdmin-4.0.10.20-all-languages.zip’ saved [7457007/7457007]
  1. 执行以下命令,安装unzip并解压phpMyAdmin压缩包。
yum install -y unzip
unzip phpMyAdmin-4.0.10.20-all-languages.zip
  1. 执行以下命令,复制phpMyAdmin文件到数据存放目录。
mv phpMyAdmin-4.0.10.20-all-languages/*  /var/www/html/phpmyadmin
  1. 在本地浏览器的址栏中,输入http://实例公网 IP/phpmyadmin,访问phpMyAdmin。
返回页面如下图所示,说明phpMyAdmin安装成功。
学习报告:冬季实战营第一期
  1. 在phpMyAdmin登录页面,依次输入MySQL的用户名和密码,单击执行。

学习报告:冬季实战营第一期

返回页面如下图所示,表示MySQL连接成功。

学习报告:冬季实战营第一期

ECS服务器部署MySQL数据库

安装MySQL

MySQL是一个关系型数据库管理系统,本步骤指导您如何在ECS实例上安装MySQL。

配置MySQL

  1. 执行如下命令,启动MySQL服务。

    systemctl start mysqld

  2. 执行如下命令,设置MySQL服务开机自启动。

    systemctl enable mysqld

  3. 执行如下命令,查看/var/log/mysqld.log文件,获取root用户的初始密码。
grep "password" /var/log/mysqld.log

说明 :下一步对MySQL进行安全性配置时,会使用该初始密码。

MySQL安全性配置。

  1. 执行如下命令,对MySQL进行安全性配置。

    mysql_secure_installation

  2. 输入root用户的初始密码按下Enter键。
  3. root用户的现有密码已过期,输入root用户的新密码并按下Enter键。

说明:新密码长度为8至30个字符,必须同时包含大小写英文字母、数字和特殊符号。特殊符号可以是

    ()` ~!@#$%^&*-+=|{}[]:;‘<>,.?/。
  1. 再次输入root用户的新密码并按下Enter键。
  2. 输入N并按下Enter键,不更改root用户密码。
  3. 输入Y按下Enter键,删除匿名用户。
  4. 输入Y按下Enter键,禁止root账号远程登录。
  5. 输入Y按下Enter键,删除test库以及对test库的访问权限。
  6. 输入Y按下Enter键,重新加载授权表。

远程访问MySQL数据库

您可以使用数据库客户端或阿里云提供的数据管理服务DMS(Data Management Service)来远程访问MySQL数据库。本步骤指导您创建新的MySQL用户,通过DMS远程访问MySQL数据库。

  1. 在ECS实例上,创建远程登录MySQL的账号。

    • 执行如下命令,使用root用户登录数据库。

      mysql -uroot -p

返回结果如下所示,输入root用户的密码并按下Enter键。

  • 依次执行如下命令,创建并授权用于远程访问MySQL的账号。示例账号为dms、密码为PASSword123!。
说明 :

建议您使用非root账号远程登录MySQL数据库。
实际创建账号时,密码需符合要求。长度为8至30个字符,必须同时包含大小写英文字母、数字和特殊符号。可以使用以下特殊符号:()` ~!@#$%^&*-+=|{}[]:;‘<>,.?/。

create user 'dms'@'%' identified by 'PASSword123!';
grant all privileges on *.* to 'dms'@'%'with grant option;
flush privileges;
输入exit退出数据库。
  1. 在实验室页面右侧,单击学习报告:冬季实战营第一期图标,切换至远程桌面。
  2. 双击打开虚拟桌面的Firefox ESR浏览器,在RAM用户登录框中单击下一步,复制云产品资源列表中子用户密码,按CTRL+V把密码粘贴到密码输区,登录子账户(后续在远程桌面里的粘贴操作均使用CTRL + V快捷键)。
  3. 复制数据管理DMS控制台地址,在FireFox浏览器打开新页签,粘贴并访问数据管理DMS控制台。

    https://dms.aliyun.com/new

  4. 在左侧导航栏中,单击学习报告:冬季实战营第一期 图标。
  5. 在新增实例对话框中,单击ECS自建数据库。
  6. 在新增实例对话框的ECS自建数据库页签中,单击MySQL。
  7. 在新增实例对话框的基本信息区域中,配置自建数据库信息,单击测试连接。

参数说明:

  • 实例区域:选择ECS实例所在地域,可在云产品资源列表中查看ECS实例所在地域。本示例为华东2(上海)。
  • ECS实例ID:选择ECS实例ID,可在云产品资源列表中查看ECS实例ID所在地域。
  • 端口:3306
  • 数据库用户名:输入步骤四-1中创建的数据库用户。本示例为dms
  • 密码:输入步骤四-1中创建的数据库用户的密码。本示例为PASSword123!
  1. 在成功对话框中,单击确认。
  2. 在新增实例对话框中,单击提交。
  3. 在登录确认对话框中,单击确认。
上一篇:linux 禁止指定ip访问


下一篇:Linux基础命令---slabtop显示内核板条信息