1. 程式人生 > 實用技巧 >MySQL 冷備份 恢復 (兼建立)

MySQL 冷備份 恢復 (兼建立)

目錄

MySQL 冷備份 恢復 (兼建立)

安裝mariaDB 資料庫

資料目錄為/mysql/date

  1. 新機器環境為centos 7,會自帶安裝mariadb,首先解除安裝mariadb
[root@localhost ~]# rpm -qa|grep mariadb
mariadb-libs-5.5.60-1.el7_5.x86_64
[root@localhost ~]# rpm -e mariadb-libs-5.5.60-1.el7_5.x86_64
error: Failed dependencies:
        libmysqlclient.so.18()(64bit) is needed by (installed) postfix-2:2.10.1-7.el7.x86_64
        libmysqlclient.so.18(libmysqlclient_18)(64bit) is needed by (installed) postfix-2:2.10.1-7.el7.x86_64
[root@localhost ~]# rpm -e mariadb-libs-5.5.60-1.el7_5.x86_64 --nodeps
[root@localhost ~]# rpm -qa|grep mariadb
  1. 安裝mariadb
    通過yum;或者自行下載RPM 和依賴包安裝。

    ***** 將/var/lib/mysql 下的檔案,複製到所需的資料檔案目錄。修改所屬使用者和組。

3.編輯MariaDB 配置檔案
編輯/etc/my.cnf.d/server.cnf ,或者/etc/my.cnf 檔案

#
# These groups are read by MariaDB server.
# Use it for options that only the server (but not clients) should see
#
# See the examples of server my.cnf files in /usr/share/mysql/
#
# this is read by the standalone daemon and embedded servers

[client]
socket=/u01/mysql/data/mysql.sock

[server]
socket=/u01/mysql/data/mysql.sock
datadir=/u01/mysql/data

[mysqld]
[galera]
[embedded]
[mariadb]
[mariadb-10.4]

可能遇到的問題

1. 安裝完畢MariaDB資料庫無法啟動。


mariadb 服務對  /home 路徑無使用許可權