如何在Debian 9 / Debian 8上安裝MariaDB 10.3
阿新 • • 發佈:2018-12-16
原作者:Josphat Mutai 翻譯&轉載來源:https://computingforgeeks.com/how-to-install-mariadb-10-3-on-debian-9-debian-8/
如何在Debian 9 / Debian 8上安裝MariaDB 10.3
大家好!在本指南中,我們將介紹如何在Debian 9 Stretch和Debian 8 Jessie上安裝MariaDB 10.3。MariaDB是一個在通用公共許可證版本2下發布的開源資料庫伺服器。在撰寫本文時,MariaDB 10.3是MariaDB的當前主要穩定版本,這將支援到2023年5月。對於MariaDB 10.3的所有功能,請檢查 功能頁面。
對於CentOS 7和Ubuntu 18.04,請檢查: 在Ubuntu 18.04和CentOS 7上安裝MariaDB 10.x
對於Ubuntu 16.04使用 如何在Ubuntu 16.04 LTS(Xenial)上安裝MariaDB 10.3
如何在Debian 9 / Debian 8上安裝MariaDB 10.3
在下載和安裝MariaDB 10.3之前,您需要新增官方MariaDB上游儲存庫。這包含MariaDB的二進位制包。新增如下:
第1步:安裝依賴包
sudo apt-get install software-properties-common dirmngr
第2步:新增MariaDB 10.3儲存庫並匯入GPG金鑰
對於Debian 9:
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xF1656F24C74CD1D8
sudo add-apt-repository'deb [arch = amd64,i386,ppc64el] http://mirror.zol.co.zw/mariadb/repo/10.3/debian stretch main'
對於Debian 8:
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db sudo add-apt-repository'deb [arch = amd64,i386,ppc64el] http://mirror.zol.co.zw/mariadb/repo/10.3/debian jessie main'
匯入金鑰並新增儲存庫後,您可以使用以下命令安裝MariaDB:
sudo apt-get update && sudo apt-get install mariadb-server
當提示您設定root密碼時,請提供密碼並確認。
完成後,它將完成安裝並啟動mysql服務。您可以使用以下方式檢查狀
$ sudo systemctl status mysql
●mariadb.service - MariaDB 10.3.8資料庫伺服器
已載入:已載入(/lib/systemd/system/mariadb.service;已啟用;供應商預設:已啟用)
Drop-In:/etc/systemd/system/mariadb.service.d
└─migrated從 - my.cnf中,settings.conf
活躍:自2018-08-10 10:38:08 UTC以來活躍(正在執行); 34分鐘前
檔案:man:mysqld(8)
https://mariadb.com/kb/en/library/systemd/
主PID:5468(mysqld)
狀態:“立即提出您的SQL請求......”
CGroup:/system.slice/mariadb.service
└─5468/ usr / sbin / mysqld
您也可以登入以檢查資料庫版本:
[email protected]:~# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 11
Server version: 10.3.8-MariaDB-1:10.3.8+maria~stretch-log mariadb.org binary distribution
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.3.8-MariaDB-1:10.3.8+maria~stretch-log |
+-------------------------------------------+
1 row in set (0.000 sec)
MariaDB [(none)]>
就這樣。喜歡在Debian 9 / Debian 8伺服器上執行MariaDB 10.3。