CentOS 8通過DNF命令安裝最新版的LNMP(Linux+Nginx+MariaDB+PHP)

今天給大家講解下如何安裝LNMP ,首先呢我們要知道上面是DNF命令是什麼.

  1. DNF是什麼?
  2. YUM是什麼?
  3. DNF和YUM的區別,爲什麼用DNF代替YUM?
  4. 安裝Nginx
  5. 安裝PHP7.4
  6. 安裝MariaDB

DNF是什麼?

DNF僅僅是基於RPM的Linux發行版(如CentOS、RHEL、Fedora等)的下一代包管理器(在YUM之後)。在本文中,我將向您展示如何使用DNF包管理器來管理CentOS 8包。接下來跟着我學習一步一步的學習吧。

如果瀏覽不順暢請到 原文章出處:https://www.sky8g.com/technology/3309/

請注意可能會提示風險,這是csdn設置網站設置的問題,請放心訪問,謝謝。

https://www.sky8g.com/technology/3309/

本篇文章原創文章禁止抄襲和複製,否者必究。
 

DNF命令的一般語法

1

dnf [Option] [Command] [Package_Name]

DNF配置文件的位置

1

2

3

Main Configuration: /etc/dnf/dnf.conf

Repository: /etc/yum.repos.d/

Cache Files: /var/cache/dnf

常用的DNF命令如下

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

+---------------------+-------------------------------------------------------------------------------------------+

|      Command        |                                         Description                                       |

+---------------------+-------------------------------------------------------------------------------------------+

|repolist             | Display the configured software repositories                                              |

|install              | Install a single or multiple packages on your system                                      |

|upgrade              | Upgrade a package or packages on your system                                              |

|upgrade-minimal      | Upgrade, but only 'newest' package match which fixes a problem that affects your system   |

|list                 | List a package or groups of packages                                                      |

|info                 | Display details about a package or group of packages                                      |

|updateinfo           | Display advisories about packages                                                         |

|search               | Search package details for the given string                                               |

|check-update         | Check for available package upgrades                                                      |

|remove               | Remove a package or packages from your system                                             |

|reinstall            | Reinstall a package                                                                       |

|downgrade            | Downgrade a package                                                                       |

|autoremove           | Remove all unneeded packages that were originally installed as dependencies               |

|distro-sync          | Synchronize installed packages to the latest available versions                           |

|makecache            | Generate the metadata cache                                                               |

|repository-packages  | Run commands on top of all packages in given repository                                   |

|provides             | Find what package provides the given value                                                |

|group                | Display, or use, the groups information                                                   |

|history              | Display, or use, the transaction history                                                  |

|clean                | Remove cached data                                                                        |

|help                 | Display a helpful usage message                                                           |

+---------------------+-------------------------------------------------------------------------------------------+

 

YUM是什麼?

Yum是使用RPM軟件包管理器的Linux操作系統的免費開放源代碼命令行軟件包管理應用程序。
Yum是rpm的前端工具,可自動解決軟件包的依賴性。它從發行官方存儲庫和其他第三方存儲庫安裝RPM軟件包。Yum允許您從系統中安裝,更新,搜索和刪除軟件包。如果您想使系統保持最新,則可以通過yum-cron啓用自動更新。此外,如果需要,它還允許您從yum更新中排除一個或多個軟件包。
每個Linux發行版都有自己的軟件包管理器,請單擊下面的鏈接將其全部檢出

YUM命令的常規語法

1

yum [選項] [命令] [Package_Name]

YUM配置文件的位置

1

2

3

4

5

6

主要配置文件:/etc/yum.conf

其他存儲庫文件:/etc/yum.repos.d/

緩存文件:/ var / cache / yum

日誌文件:/var/log/yum.log

Yum插件配置:/etc/yum/pluginconf.d/

/etc/yum/version-groups.conf

 

DNF和YUM的區別,爲什麼用DNF代替YUM?

在centos 8以前的版本中我們經常是使用的是yum命令進行安裝,如今現在linux centos系列的最新系統centos 8把dnf命令作爲核心命令,也就是所你不用安裝dnf就可以使用他了,那麼爲什麼centos 8建議你使用dnf呢?

DNF和YUM的區別

Yum軟件包管理器已由 DNF軟件包管理器代替,因爲Yum中許多長期存在的問題仍未解決。

這些問題包括性能不佳,內存使用過多,依賴性解析速度變慢。

DNF使用“ libsolv”進行依賴關係解析,由SUSE開發和維護以提高性能。

通過下面表我們可以看到是DNF和YUM的最大區別。

序號 DNF (Dandified YUM) YUM (Yellowdog Updater, Modified)
1 DNF使用libsolv進行依賴項解析,由SUSE開發和維護。 YUM使用公共API進行依賴項解析
2 API已完全記錄 API尚未完全記錄
3 它是用C,C ++,Python編寫的 它僅用Python編寫
4 DNF當前在Fedora,Red Hat Enterprise Linux 8(RHEL),CentOS 8,OEL 8和Mageia 6/7中使用。 YUM當前用於Red Hat Enterprise Linux 6/7(RHEL),CentOS 6/7,OEL 6/7。
5 DNf支持各種擴展 Yum僅支持基於Python的擴展
6 該API有充分的文檔記錄,因此可以輕鬆創建新功能 由於沒有正確記錄API,因此很難創建新功能。
7 同步存儲庫的元數據時,DNF使用較少的內存。 在同步存儲庫的元數據時,YUM使用過多的內存。
8 DNF使用可滿足性算法來解決依賴關係解析(它使用字典方法來存儲和檢索包及依賴關係信息)。 由於公共API,Yum依賴項解析變得緩慢。
9 就內存使用率和存儲庫元數據的依存關係解析而言,所有性能都很好。 總體而言,許多方面的表現都很差。
10 DNF更新:如果軟件包在DNF更新過程中包含無關的依賴項,則不會更新該軟件包。 YUM將更新軟件包而不進行驗證。
11 如果啓用的存儲庫沒有響應,則dnf將跳過它並繼續使用可用存儲庫進行事務。 如果存儲庫不可用,則YUM將立即停止。
12 dnf更新和dnf升級相等。 YUM就不同了
13 軟件包安裝的依賴關係未更新 YUM爲這種行爲提供了一個選擇
14 清理軟件包刪除:刪除軟件包時,dnf會自動刪除用戶未明確安裝的所有依賴軟件包。 YUM沒有這樣做
15 Repo Cache更新計劃:默認情況下,系統啓動後十分鐘,dnf每小時檢查一次已配置存儲庫的更新。此操作由名爲“ /usr/lib/systemd/system/dnf-makecache.timer”的系統計時器單元控制。 YUM也這樣做。
16 內核軟件包不受dnf保護。與Yum不同,您可以刪除所有內核程序包,包括正在運行的程序包。 Yum不允許您刪除正在運行的內核
18 DNF包含29k行代碼 Yum包含56k行代碼
19 DNF由Ales Kozumplik開發 YUM由Zdenek Pavlas,Jan Silhan和團隊成員開發

通過上面的數據對比我想你一定會愛上DNF的操作的,好吧接下來呢就讓我帶領你學習在centos 8安裝安裝最新版的LNMP(Linux+Nginx+MariaDB+PHP)吧。

安裝Nginx

首先你要使用超級用戶安裝這些軟件,不然的話沒有權限,普通用戶切換超級用戶命令

1

su -

或者使用sudo前綴進行操作,例如:

1

sudo dnf -y install http://nginx.org/packages/centos/8/x86_64/RPMS/nginx-1.16.1-1.el8.ngx.x86_64.rpm

接下來的所有命令操作我都是以超級用戶root權限進行的,後續不再贅述,請注意。

通過dnf在線安裝最新的版本:

1

dnf -y install http://nginx.org/packages/centos/8/x86_64/RPMS/nginx-1.16.1-1.el8.ngx.x86_64.rpm

如果你沒有聯網,那麼你可以通過上傳RPM包到你的服務器,然後通過離線安裝就是用下面的命令:

1

dnf localinstall package-1.2.3.rpm

如果你想自定義安裝其他的nginx的版本可以打開官網:http://nginx.org/packages/centos/8/x86_64/RPMS/進行查看如下:

你想安裝其他版本可以dnf -y install http://nginx.org/packages/centos/8/x86_64/RPMS/後面再跟包名即可:nginx-1.16.1-1.el8.ngx.x86_64.rpm

nginx-1.16.1-1.el8.ngx.x86_64.rpm:表示就是包的名字。

安裝完成後查看版本號,重啓,開機啓動設置

查看nginx版本

1

2

3

[root@localhost ~]# nginx -v

nginx version: nginx/1.16.1

[root@localhost ~]#

查看狀態是否啓動了,剛安裝的後的nginx默認是沒有激活的,查看狀態

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

[root@localhost ~]# systemctl status nginx

● nginx.service - nginx - high performance web server

   Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)

  Drop-In: /usr/lib/systemd/system/nginx.service.d

           └─php-fpm.conf

   Active: inactive (dead) since Sun 2020-03-15 12:11:32 CST; 1s ago

     Docs: http://nginx.org/en/docs/

  Process: 37713 ExecStop=/bin/kill -s TERM $MAINPID (code=exited, status=0/SUCCESS)

Main PID: 32448 (code=exited, status=0/SUCCESS)

 

Mar 14 22:57:35 localhost.localdomain systemd[1]: Starting nginx - high performance web server...

Mar 14 22:57:35 localhost.localdomain systemd[1]: Started nginx - high performance web server.

Mar 15 12:11:31 localhost.localdomain systemd[1]: Stopping nginx - high performance web server...

Mar 15 12:11:32 localhost.localdomain systemd[1]: Stopped nginx - high performance web server.

[root@localhost ~]#

啓動開機,開機的時候啓動命令

1

2

systemctl start nginx

systemctl enable nginx

再次查看狀態

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

[root@localhost ~]# systemctl status nginx

● nginx.service - nginx - high performance web server

   Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)

  Drop-In: /usr/lib/systemd/system/nginx.service.d

           └─php-fpm.conf

   Active: active (running) since Sun 2020-03-15 12:12:40 CST; 55s ago

     Docs: http://nginx.org/en/docs/

Main PID: 37738 (nginx)

    Tasks: 2 (limit: 16700)

   Memory: 2.5M

   CGroup: /system.slice/nginx.service

           ├─37738 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf

           └─37739 nginx: worker process

 

Mar 15 12:12:39 localhost.localdomain systemd[1]: Starting nginx - high performance web server...

Mar 15 12:12:40 localhost.localdomain systemd[1]: Started nginx - high performance web server.

[root@localhost ~]#

在檢查下在瀏覽器是否能夠打開,在安裝nginx激活開啓後我們還需要執行如下幾個步驟:

第一步:查看我們的防火牆是否設置端口屏蔽如果是no則需要添加端口號,因爲我們的網站是80 或者443端口,所以最後這兩個都開啓

1

2

3

[root@localhost ~]# firewall-cmd --query-port=80/tcp

no

[root@localhost ~]#

第二步:永久開啓開啓80和443端口

1

2

3

4

5

[root@localhost ~]# firewall-cmd --permanent --zone=public --add-port=80/tcp

secucessfull

[root@localhost ~]# firewall-cmd --permanent --zone=public --add-port=443/tcp

secucessfull

[root@localhost ~]#

第三步:重新reload配置一下防火牆

 

1

firewall-cmd --reload

第四步:執行 下面的命令查看ip,使用瀏覽器訪問服務器ip。

1

2

3

4

5

6

[root@localhost ~]# ifconfig

ens3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

        inet 192.168.118.150  netmask 255.255.255.0  broadcast 192.168.118.255

        ......

        ......

        ......

既是inet 對應的ip 192.168.118.150,訪問後如下圖。

安裝nginx完成ok。

安裝PHP7.4

PHP是PHP超文本預處理程序的遞歸首字母縮寫,是一種流行的服務器端腳本語言,用於創建功能強大的動態網站。

在本文中,您將學習如何在CentOS 8 Linux上安裝PHP 7.4。

步驟1:添加EPEL和Remi存儲庫

首先,您需要添加EPEL和Remi存儲庫,以便能夠在CentOS 8 Linux上安裝PHP 7.4。要在CentOS 8上安裝和啓用EPEL存儲庫,請執行以下dnf命令。

1

dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm

 

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

[root@localhost ~]# dnf install https://rpms.remirepo.net/enterprise/remi-release-8.rpm

Last metadata expiration check: 1:06:39 ago on Sat 14 Mar 2020 10:50:45 PM CST.

remi-release-8.rpm                                            5.8 kB/s |  23 kB     00:03    

Dependencies resolved.

==============================================================================================

Package                 Architecture   Version                    Repository            Size

==============================================================================================

Installing:

remi-release            noarch         8.1-2.el8.remi             @commandline          23 k

Upgrading:

centos-release          x86_64         8.1-1.1911.0.8.el8         BaseOS                21 k

Installing dependencies:

centos-gpg-keys         noarch         8.1-1.1911.0.8.el8         BaseOS                11 k

centos-repos            x86_64         8.1-1.1911.0.8.el8         BaseOS                12 k

 

Transaction Summary

==============================================================================================

Install  3 Packages

Upgrade  1 Package

 

Total size: 67 k

Total download size: 44 k

Is this ok [y/N]: y

Downloading Packages:

(1/3): centos-repos-8.1-1.1911.0.8.el8.x86_64.rpm              24 kB/s |  12 kB     00:00    

(2/3): centos-release-8.1-1.1911.0.8.el8.x86_64.rpm            37 kB/s |  21 kB     00:00    

(3/3): centos-gpg-keys-8.1-1.1911.0.8.el8.noarch.rpm           14 kB/s |  11 kB     00:00    

----------------------------------------------------------------------------------------------

Total                                                          25 kB/s |  44 kB     00:01    

Running transaction check

Transaction check succeeded.

Running transaction test

Transaction test succeeded.

Running transaction

  Preparing        :                                                                      1/1

  Running scriptlet: centos-gpg-keys-8.1-1.1911.0.8.el8.noarch                            1/1

  Installing       : centos-gpg-keys-8.1-1.1911.0.8.el8.noarch                            1/5

  Installing       : centos-repos-8.1-1.1911.0.8.el8.x86_64                               2/5

  Upgrading        : centos-release-8.1-1.1911.0.8.el8.x86_64                             3/5

  Installing       : remi-release-8.1-2.el8.remi.noarch                                   4/5

  Cleanup          : centos-release-8.0-0.1905.0.9.el8.x86_64                             5/5

  Running scriptlet: centos-release-8.0-0.1905.0.9.el8.x86_64                             5/5

  Verifying        : centos-gpg-keys-8.1-1.1911.0.8.el8.noarch                            1/5

  Verifying        : centos-repos-8.1-1.1911.0.8.el8.x86_64                               2/5

  Verifying        : remi-release-8.1-2.el8.remi.noarch                                   3/5

  Verifying        : centos-release-8.1-1.1911.0.8.el8.x86_64                             4/5

  Verifying        : centos-release-8.0-0.1905.0.9.el8.x86_64                             5/5

 

Upgraded:

  centos-release-8.1-1.1911.0.8.el8.x86_64                                                    

 

Installed:

  remi-release-8.1-2.el8.remi.noarch           centos-gpg-keys-8.1-1.1911.0.8.el8.noarch      

  centos-repos-8.1-1.1911.0.8.el8.x86_64      

 

Complete!

[root@localhost ~]#

同樣,要驗證Remi存儲庫是否存在,請運行該命令。

1

rpm -qa | grep remi

 

1

2

3

4

5

6

7

8

9

10

11

12

13

[root@localhost ~]# rpm -qa | grep remi

php-xml-7.4.3-1.el8.remi.x86_64

php-json-7.4.3-1.el8.remi.x86_64

php-cli-7.4.3-1.el8.remi.x86_64

remi-release-8.1-2.el8.remi.noarch

php-common-7.4.3-1.el8.remi.x86_64

php-opcache-7.4.3-1.el8.remi.x86_64

php-sodium-7.4.3-1.el8.remi.x86_64

php-fpm-7.4.3-1.el8.remi.x86_64

php-7.4.3-1.el8.remi.x86_64

php-pdo-7.4.3-1.el8.remi.x86_64

php-mbstring-7.4.3-1.el8.remi.x86_64

[root@localhost ~]#

步驟2:在CentOS 8上安裝PHP 7.4

當你完成成功添加EPEL和Remi存儲庫後,執行下面的命令以獲得可用PHP模塊列表。

1

dnf module list php

 

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

[root@localhost ~]#  dnf module list php

Last metadata expiration check: 0:01:25 ago on Sun 15 Mar 2020 10:14:27 AM CST.

CentOS-8 - AppStream

Name Stream   Profiles                   Summary              

php  7.2 [d]  common [d], devel, minimal PHP scripting language

php  7.3      common, devel, minimal     PHP scripting language

 

Remi's Modular repository for Enterprise Linux 8 - x86_64

Name Stream   Profiles                   Summary              

php  remi-7.2 common [d], devel, minimal PHP scripting language

php  remi-7.3 common [d], devel, minimal PHP scripting language

php  remi-7.4 common [d], devel, minimal PHP scripting language

 

Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled

[root@localhost ~]#

步驟3:我們通過上面可以看到有兩個庫的php版本,那麼我們需要安裝php7.4,所以要選擇最後一個remi版本的,接下來我們正式安裝php7.4

1

dnf module enable php:remi-7.4

步驟4:一旦啓用了PHP remi-7.4模塊,就可以使用下面的命令繼續安裝PHP。這還將安裝許多其他包,如Apache和Nginx模塊。

1

dnf install php php-cli php-common

 

步驟5:要檢查安裝的PHP版本,請運行該命令,完成。

1

2

3

4

5

6

[root@localhost ~]# php -v

PHP 7.4.3 (cli) (built: Feb 18 2020 11:53:05) ( NTS )

Copyright (c) The PHP Group

Zend Engine v3.4.0, Copyright (c) Zend Technologies

    with Zend OPcache v7.4.3, Copyright (c), by Zend Technologies

[root@localhost ~]#

通過上面我們可以地看到已經安裝好了PHP 7.4!現在可以繼續使用PHP測試和部署應用程序,接下來我們來安裝數據庫MariaDB

安裝MariaDB

第一步:安裝數據庫MariaDB

1

2

dnf install boost-program-options

dnf install MariaDB-server MariaDB-client --disablerepo=AppStream

當你執行上面的命令後出現下面,並按下 Y 鍵進行安裝

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

MariaDB                                    186 kB/s | 489 kB     00:02    

Last metadata expiration check: 0:00:01 ago on Sat 04 Jan 2020 08:37:41 PM EAT.

Dependencies resolved.

========================================================================================================================================================

Package                               Arch                          Version                                       Repository                      Size

========================================================================================================================================================

Installing:

MariaDB-client                        x86_64                        10.4.11-1.el8                                 mariadb                         12 M

MariaDB-server                        x86_64                        10.4.11-1.el8                                 mariadb                         26 M

Installing dependencies:

MariaDB-common                        x86_64                        10.4.11-1.el8                                 mariadb                         87 k

galera-4                              x86_64                        26.4.3-1.rhel8.0.el8                          mariadb                         13 M

 

Transaction Summary

========================================================================================================================================================

Install  4 Packages

 

Total download size: 51 M

Installed size: 196 M

Is this ok [y/N]: y

2.第二步:開啓並開機啓動數據庫MariaDB service

1

systemctl enable --now mariadb

查看運行的狀態如下

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

systemctl status mariadb

● mariadb.service - MariaDB 10.4.11 database server

   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)

  Drop-In: /etc/systemd/system/mariadb.service.d

           └─migrated-from-my.cnf-settings.conf

   Active: active (running) since Sat 2020-01-04 20:40:50 EAT; 15s ago

     Docs: man:mysqld(8)

           https://mariadb.com/kb/en/library/systemd/

Main PID: 31317 (mysqld)

   Status: "Taking your SQL requests now..."

    Tasks: 30 (limit: 11512)

   Memory: 73.4M

   CGroup: /system.slice/mariadb.service

           └─31317 /usr/sbin/mysqld

 

Jan 04 20:40:50 centos8.novalocal mysqld[31317]: 2020-01-04 20:40:50 0 [Note] InnoDB: 10.4.11 started; log sequence number 60972; transaction id 21

Jan 04 20:40:50 centos8.novalocal mysqld[31317]: 2020-01-04 20:40:50 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool

Jan 04 20:40:50 centos8.novalocal mysqld[31317]: 2020-01-04 20:40:50 0 [Note] InnoDB: Buffer pool(s) load completed at 200104 20:40:50

Jan 04 20:40:50 centos8.novalocal mysqld[31317]: 2020-01-04 20:40:50 0 [Note] Plugin 'FEEDBACK' is disabled.

Jan 04 20:40:50 centos8.novalocal mysqld[31317]: 2020-01-04 20:40:50 0 [Note] Server socket created on IP: '::'.

Jan 04 20:40:50 centos8.novalocal mysqld[31317]: 2020-01-04 20:40:50 0 [Note] Reading of all Master_info entries succeeded

Jan 04 20:40:50 centos8.novalocal mysqld[31317]: 2020-01-04 20:40:50 0 [Note] Added new Master_info '' to hash table

Jan 04 20:40:50 centos8.novalocal mysqld[31317]: 2020-01-04 20:40:50 0 [Note] /usr/sbin/mysqld: ready for connections.

Jan 04 20:40:50 centos8.novalocal mysqld[31317]: Version: '10.4.11-MariaDB'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MariaDB Server

Jan 04 20:40:50 centos8.novalocal systemd[1]: Started MariaDB 10.4.11 database server.

3.第三步:數據庫安全設置

好了,現在我們對MariaDB 10.4已經安裝在CentOS 8上,通過運行mysql_secure_installation命令來保護它。

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

mysql_secure_installation

 

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB

      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

 

In order to log into MariaDB to secure it, we'll need the current

password for the root user.  If you've just installed MariaDB, and

you haven't set the root password yet, the password will be blank,

so you should just press enter here.

 

Enter current password for root (enter for none):

OK, successfully used password, moving on...

 

Setting the root password ensures that nobody can log into the MariaDB

root user without the proper authorisation.

 

Set root password? [Y/n] y

New password:

Re-enter new password:

Password updated successfully!

Reloading privilege tables..

... Success!

 

By default, a MariaDB installation has an anonymous user, allowing anyone

to log into MariaDB without having to have a user account created for

them.  This is intended only for testing, and to make the installation

go a bit smoother.  You should remove them before moving into a

production environment.

 

Remove anonymous users? [Y/n] y

... Success!

 

Normally, root should only be allowed to connect from 'localhost'.  This

ensures that someone cannot guess at the root password from the network.

 

Disallow root login remotely? [Y/n] y

... Success!

 

By default, MariaDB comes with a database named 'test' that anyone can

access.  This is also intended only for testing, and should be removed

before moving into a production environment.

 

Remove test database and access to it? [Y/n] y

- Dropping test database...

... Success!

- Removing privileges on test database...

... Success!

 

Reloading the privilege tables will ensure that all changes made so far

will take effect immediately.

 

Reload privilege tables now? [Y/n] y

... Success!

 

Cleaning up...

 

All done!  If you've completed all of the above steps, your MariaDB

installation should now be secure.

 

Thanks for using MariaDB!

4.第四步:測試訪問數據庫。

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

mysql -u root -p

Enter password:

Welcome to the MariaDB monitor.  Commands end with ; or \g.

Your MariaDB connection id is 19

Server version: 10.4.11-MariaDB MariaDB Server

 

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

 

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

 

MariaDB [(none)]> SELECT version();

+-----------------+

| version()       |

+-----------------+

| 10.4.11-MariaDB |

+-----------------+

1 row in set (0.000 sec)

 

MariaDB [(none)]> QUIT

Bye

ok,通過上面我們已經學習完成安裝好了數據庫,以及所有的web服務LNMP軟件,希望對你有幫助。

如果有不懂的地方請留言,SKY8G網站編輯者專注於研究IT源代碼研究與開發。希望你下次光臨,你的認可和留言是對我們最大的支持,謝謝!

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章