本文再也不更新,可能存在內容過期的狀況,實時更新請移步原文地址:CentOS使用rpm離線安裝mariadb;mysql
環境:
- CentOS Linux release 7.6.1810 (Core)
- mariadb:10.4.7
<!--more-->sql
安裝過程當中我是使用root用戶操做的。數據庫
依賴
離線安裝不容易啊,按照官方文檔:<a href="https://mariadb.com/kb/en/library/mariadb-installation-version-10121-via-rpms-on-centos-7/" target="_blank">Installing MariaDB With the rpm Tool</a> 的意思,是須要jemalloc
、MariaDB*
、galera
等,可是我只用到了下面的依賴,沒有裝jemalloc*
。文件能夠自行 <a href="https://www.4spaces.org/gfw/">Google</a>,總結就是,缺什麼裝什麼。centos
boost-program-options-1.53.0-27.el7.x86_64.rpm(galera須要) galera-4-26.4.0-1.rhel7.el7.centos.x86_64.rpm perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64.rpm perl-Data-Dumper-2.145-3.el7.x86_64.rpm perl-DBI-1.627-4.el7.x86_64.rpm perl-IO-Compress-2.061-2.el7.noarch.rpm perl-Net-Daemon-0.48-5.el7.noarch.rpm perl-PlRPC-0.2020-14.el7.noarch.rpm perl-Compress-Raw-Zlib-2.061-4.el7.x86_64.rpm
下載
下載地址:http://downloads.mariadb.org/ ,選擇適合本身的鏡像地址進行下載。ide
MariaDB-client-10.4.7-1.el7.centos.x86_64.rpm MariaDB-devel-10.4.7-1.el7.centos.x86_64.rpm MariaDB-server-10.4.7-1.el7.centos.x86_64.rpm MariaDB-shared-10.4.7-1.el7.centos.x86_64.rpm
標準的服務端至少要下載client、shared和server,點擊<a href="https://mariadb.com/kb/en/about-the-mariadb-rpm-files/" target="_blank">這裏</a> 查看各個rpm的含義。測試
卸載舊版本Mysql
安裝以前,舊版本的MYSQL會與MariaDB有衝突,所以須要先卸載MYSQL。檢查是否安裝:ui
rpm -qa 'mysql*'
安裝依賴
rpm -ivh boost-program-options-1.53.0-27.el7.x86_64.rpm rpm -ivh galera-4-26.4.0-1.rhel7.el7.centos.x86_64.rpm rpm -ivh perl*
安裝MariaDB
rpm -ivh MariaDB-*
啓動服務
systemctl start mariadb #馬上啓動 systemctl enable mariadb #開機啓動 systemctl status mariadb #查看服務狀態
設置root密碼
/usr/bin/mysqladmin -u root password '1234567890'
經過修改mysql
數據庫,配置實現遠程鏈接:this
[root@localhost seafile-env]# /usr/bin/mysql -u root -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 9 Server version: 10.4.7-MariaDB MariaDB Server 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)]> use mysql; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed MariaDB [mysql]> grant all privileges on *.* to root@'localhost' identified by "Passw0rd"; Query OK, 0 rows affected (0.098 sec) MariaDB [mysql]> grant all privileges on *.* to root@'%' identified by "Passw0rd"; Query OK, 0 rows affected (0.028 sec) MariaDB [mysql]> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.001 sec) MariaDB [mysql]>
測試鏈接
若是鏈接失敗,多是端口沒有開放的緣由,默認端口是3306,參考這篇文章:CentOS開放端口的方法,對端口進行放開。spa
錯誤及解決
錯誤1:code
1)信息
error: Failed dependencies: MariaDB-compat is needed by MariaDB-common-10.4.7-1.el7.centos.x86_64 galera-4 is needed by MariaDB-server-10.4.7-1.el7.centos.x86_64 perl(Data::Dumper) is needed by MariaDB-server-10.4.7-1.el7.centos.x86_64 perl(DBI) is needed by MariaDB-server-10.4.7-1.el7.centos.x86_64
2)解決
yum remove mariadb-libs -y
本文再也不更新,可能存在內容過期的狀況,實時更新請移步原文地址:CentOS使用rpm離線安裝mariadb;