Linux安裝MariaDB數(shù)據(jù)庫的實(shí)例詳解
1. 下載MariaDB數(shù)據(jù)庫
測(cè)試: 當(dāng)前虛擬機(jī)是否可以正確的鏈接外網(wǎng).
命令:
[root@localhost src]# yum install mariadb-server 安裝mariadb數(shù)據(jù)庫 [root@localhost src]# yum clean all 清空已安裝文件 如果下載失敗之后執(zhí)行的.
2 確認(rèn)下載
3 安裝完成提示
4 數(shù)據(jù)庫啟動(dòng)
命令:
1. 啟動(dòng)命令 [root@localhost src]# systemctl start mariadb
2. 重啟命令 [root@localhost src]# systemctl restart mariadb
3. 關(guān)閉命令 [root@localhost src]# systemctl stop mariadb
5. 數(shù)據(jù)庫初始化操作
命令:
6. 測(cè)試數(shù)據(jù)庫用戶名和密碼是否有效
7.導(dǎo)入數(shù)據(jù)表
說明:如果mysql數(shù)據(jù)庫需要導(dǎo)入數(shù)據(jù)表命令如下:
命令:
source /xxx/xxxx/xxxx/jtdb.sql;
8.Mysql數(shù)據(jù)庫遠(yuǎn)程訪問配置
8.1 關(guān)于鏈接數(shù)據(jù)庫的說明
說明:
1. 如果需要遠(yuǎn)程鏈接數(shù)據(jù)庫必須通過防火墻
2. 如果遠(yuǎn)程鏈接數(shù)據(jù)庫,數(shù)據(jù)庫中必須開啟遠(yuǎn)程訪問權(quán)限才行,否則拒絕鏈接.
8.2 配置數(shù)據(jù)庫權(quán)限配置說明
8.3 配置Linux數(shù)據(jù)庫權(quán)限 8.3.1 切換數(shù)據(jù)庫mysql
切換Mysql數(shù)據(jù)庫
8.3.2 修改數(shù)據(jù)庫表
1).檢查數(shù)據(jù)表
2).查詢user表中的host/root/password
3).將host=“l(fā)ocalhost” 改為 “%”
4).刷新數(shù)據(jù)庫權(quán)限
9. 配置Linux防火墻策略 9.1 檢查防火墻狀態(tài)
命令:
firewall-cmd --state
9.2 防火墻配置
說明:防火墻中有一個(gè)配置文件,表示當(dāng)Linux系統(tǒng)啟動(dòng)時(shí)防火墻應(yīng)該如何操作!!!
需求: 告訴linux系統(tǒng)以后開機(jī)不需要啟動(dòng)防火墻
命令:
systemctl disable firewalld.service systemctl enable firewalld.service
9.3 手動(dòng)關(guān)閉防火墻
說明:通過命令手動(dòng)將防火墻關(guān)閉
命令:
systemctl stop firewalld.service systemctl start firewalld.service
9.4 手動(dòng)開放防火墻端口
1). 檢查防火墻開放的端口
firewall-cmd --list-ports
2).檢查端口是否開放
firewall-cmd --query-port 80/tcp
3). 開啟防火墻
firewall-cmd --zone=public --add-port=80/tcp --permanent
4).移除端口
firewall-cmd --zone=public --remove-port=9090/tcp --permanent
5).關(guān)于防火墻操作的解釋
–zone #作用域
–add-port=80/tcp #添加端口,格式為:端口/通訊協(xié)議
–remove-port=80/tcp #移除端口,格式為:端口/通訊協(xié)議
–permanent #永久生效,沒有此參數(shù)重啟后失效
6).重啟防火墻
firewall-cmd --reload
9.4 數(shù)據(jù)庫遠(yuǎn)程測(cè)試
9.5 導(dǎo)入jtdb.sql
到此這篇關(guān)于Linux安裝MariaDB數(shù)據(jù)庫的實(shí)例詳解的文章就介紹到這了,更多相關(guān)Linux安裝MariaDB內(nèi)容請(qǐng)搜索本站以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持本站!
版權(quán)聲明:本站文章來源標(biāo)注為YINGSOO的內(nèi)容版權(quán)均為本站所有,歡迎引用、轉(zhuǎn)載,請(qǐng)保持原文完整并注明來源及原文鏈接。禁止復(fù)制或仿造本網(wǎng)站,禁止在非www.sddonglingsh.com所屬的服務(wù)器上建立鏡像,否則將依法追究法律責(zé)任。本站部分內(nèi)容來源于網(wǎng)友推薦、互聯(lián)網(wǎng)收集整理而來,僅供學(xué)習(xí)參考,不代表本站立場(chǎng),如有內(nèi)容涉嫌侵權(quán),請(qǐng)聯(lián)系alex-e#qq.com處理。