最近在研究freenas跟owncloud的時候,發現centos7內附的資料庫

Mariadb過於老舊,停留在5.5版本上,但現在Mariadb官網早就推進

到10.3版了,於是參考網路上文章來更新一下資料庫。

首先新增一個mariadb的源檔:

touch /etc/yum.repos.d/MariaDB10.repo

然後用文書編輯軟體vi或vim或mc等工具編輯內容:

# MariaDB 10.3 CentOS repository list - created 2017-12-01 11:36 UTC

# http://downloads.mariadb.org/mariadb/repositories/

[mariadb]

name = MariaDB

baseurl = http://yum.mariadb.org/10.3/centos7-amd64

gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1
 

存檔後離開

然後先停止MariaDB:

service mariadb stop

 

先移除舊版mariadb:

yum remove MariaDB-server MariaDB-client

 

再安裝新版本:

yum install MariaDB-server MariaDB-client

 

等安裝完畢之後重啟mariadb服務:

service mariadb start

 

最後用root登入資料庫看看版本是不是有更新了:

mysql -u root -p

 

版號如下圖,顯示正確就是更新成功。

 

MariaDB官網的10.3升級說明:

https://downloads.mariadb.org/mariadb/repositories/#mirror=ossplanet&distro=CentOS&distro_release=centos7-amd64--centos7&version=10.3

參考資料:

https://blog.csdn.net/junehappylove/article/details/78690743

 

順便補上資料庫的一些簡單操作指令:

備份所有資料庫,匯出成【mysql.sql】
mysqldump -uroot -p -A --default-character-set=utf8 > mysql.sql


匯出資料庫【owncloud】到【owncloud.sql】
mysqldump -uroot -p -a --default-character-set=utf8 orztw > orztw.sql

 
MySQL、MariaDB還原指令

還原所有資料庫從【mysql.sql】
    
mysql -uroot -p < mysql.sql

還原資料庫【owncloud】從【/root/owncloud.sql】
    
mysql --user=root -p owncloud < /root/owncloud.sql

 

arrow
arrow
    全站熱搜

    呂阿谷 發表在 痞客邦 留言(0) 人氣()