溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

Debian和buntu中如何安裝MariaDB 10

發(fā)布時(shí)間:2022-02-17 11:36:53 來(lái)源:億速云 閱讀:184 作者:小新 欄目:開發(fā)技術(shù)

這篇文章主要介紹Debian和buntu中如何安裝MariaDB 10,文中介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們一定要看完!

MariaDB數(shù)據(jù)庫(kù)管理系統(tǒng)是MySQL的一個(gè)分支,主要由開源社區(qū)在維護(hù),采用GPL授權(quán)許可 MariaDB的目的是完全兼容MySQL,包括API和命令行,使之能輕松成為MySQL的代替品。

Debian和buntu中如何安裝MariaDB 10

在 Debian 和 Ubuntu 上安裝 MariaDB

1、在安裝之前 MariaDB 之前,你需要通過(guò)下面的命令導(dǎo)入倉(cāng)庫(kù)密匙并獲取 MariaDB 倉(cāng)庫(kù)

在 Debian 10 (Sid) 上

$ sudo apt-get install software-properties-common
$ sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xF1656F24C74CD1D8
$ sudo add-apt-repository 'deb [arch=amd64,i386] http://www.ftp.saix.net/DB/mariadb/repo/10.1/debian sid main'

在 Debian 9 (Stretch) 上

$ sudo apt-get install software-properties-common
$ sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xF1656F24C74CD1D8
$ sudo add-apt-repository 'deb [arch=amd64] http://www.ftp.saix.net/DB/mariadb/repo/10.1/debian stretch main'

在 Debian 8 (Jessie) 上

$ sudo apt-get install software-properties-common
$ sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db
$ sudo add-apt-repository 'deb [arch=amd64,i386,ppc64el] http://www.ftp.saix.net/DB/mariadb/repo/10.1/debian  jessie main'

在 Debian 7 (Wheezy) 上

$ sudo apt-get install python-software-properties
$ sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db
$ sudo add-apt-repository 'deb [arch=amd64,i386] http://www.ftp.saix.net/DB/mariadb/repo/10.1/debian wheezy main'

在 Ubuntu 16.10 (Yakkety Yak) 上

$ sudo apt-get install software-properties-common
$ sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
$ sudo add-apt-repository 'deb [arch=amd64,i386] http://www.ftp.saix.net/DB/mariadb/repo/10.1/ubuntu yakkety main'

在 Ubuntu 16.04 (Xenial Xerus) 上

$ sudo apt-get install software-properties-common
$ sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
$ sudo add-apt-repository 'deb [arch=amd64,i386,ppc64el] http://www.ftp.saix.net/DB/mariadb/repo/10.1/ubuntu xenial main'

在 Ubuntu 14.04 (Trusty) 上

$ sudo apt-get install software-properties-common
$ sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db
$ sudo add-apt-repository 'deb [arch=amd64,i386,ppc64el] http://www.ftp.saix.net/DB/mariadb/repo/10.1/ubuntu trusty main'

2、 然后,更新系統(tǒng)安裝包列表,并像下面這樣安裝 MariaDB 服務(wù)器

$ sudo apt-get update
$ sudo apt-get install mariadb-server

安裝過(guò)程中,將會(huì)請(qǐng)求你配置 MariaDB 服務(wù)器;在下面的頁(yè)面中設(shè)置一個(gè)安全的 root 用戶密碼:

Debian和buntu中如何安裝MariaDB 10

為 MariaDB 設(shè)置新的 Root 密碼

再次輸入密碼并按下回車鍵來(lái)繼續(xù)安裝。

Debian和buntu中如何安裝MariaDB 10

再次輸入 MariaDB 密碼

當(dāng) MariaDB 安裝包安裝完成以后,啟動(dòng)數(shù)據(jù)庫(kù)服務(wù)器守護(hù)進(jìn)程,同時(shí)啟用它,使得在下次開機(jī)時(shí)它能夠像下面這樣自動(dòng)啟動(dòng):

------------- On SystemD Systems -------------
$ sudo systemctl start mariadb
$ sudo systemctl enable mariadb
$ sudo systemctl status mariadb
------------- On SysVinit Systems -------------
$ sudo service mysql  start
$ chkconfig --level 35 mysql on
OR
$ update-rc.d mysql defaults
$ sudo service mysql status
Debian和buntu中如何安裝MariaDB 10

開啟 MariaDB 服務(wù)

4、 然后,運(yùn)行 mysql_secure_installation 腳本來(lái)保護(hù)數(shù)據(jù)庫(kù),在這兒你可以:

  1. 設(shè)置 root 密碼(如果在上面的配置環(huán)節(jié)你沒有進(jìn)行設(shè)置的話)。
  2. 禁止遠(yuǎn)程 root 登錄
  3. 移除測(cè)試數(shù)據(jù)庫(kù)
  4. 移除匿名用戶
  5. 重載權(quán)限配置
$ sudo mysql_secure_installation
Debian和buntu中如何安裝MariaDB 10

保護(hù) MariaDB 安裝

5、 一旦數(shù)據(jù)庫(kù)服務(wù)器受保護(hù)以后,可以使用下面的 shell 命令查看已安裝版本和登錄 MariaDB:

$ mysql -V
$ mysql -u root -p
Debian和buntu中如何安裝MariaDB 10


以上是“Debian和buntu中如何安裝MariaDB 10”這篇文章的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對(duì)大家有幫助,更多相關(guān)知識(shí),歡迎關(guān)注億速云行業(yè)資訊頻道!

向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI