日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > linux >内容正文

linux

Linux系统之安装mariadb方法

發(fā)布時間:2023/12/20 linux 25 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Linux系统之安装mariadb方法 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

Linux系統(tǒng)之安裝mariadb方法

  • 一、檢查系統(tǒng)版本
  • 二、配置mariadb的yum源
    • 1.配置yum源
    • 2.替換中科大的源
  • 三、檢查yum倉庫
    • 1.修改/etc/yum.conf文件
    • 2.檢查yum倉庫
  • 四、安裝mariadb
  • 五、啟動mariadb服務
    • 1.啟動mariadb服務
    • 2.查看mariadb服務狀態(tài)
  • 六、mariadb的遠程連接
    • 1.本地連接
    • 2.創(chuàng)建用戶
    • 3.對用戶授權(quán)
    • 4.測試遠程連接mariadb數(shù)據(jù)庫

一、檢查系統(tǒng)版本

[root@serer01 ~]# cat /etc/os-release NAME="CentOS Linux" VERSION="7 (Core)" ID="centos" ID_LIKE="rhel fedora" VERSION_ID="7" PRETTY_NAME="CentOS Linux 7 (Core)" ANSI_COLOR="0;31" CPE_NAME="cpe:/o:centos:centos:7" HOME_URL="https://www.centos.org/" BUG_REPORT_URL="https://bugs.centos.org/"CENTOS_MANTISBT_PROJECT="CentOS-7" CENTOS_MANTISBT_PROJECT_VERSION="7" REDHAT_SUPPORT_PRODUCT="centos" REDHAT_SUPPORT_PRODUCT_VERSION="7"

二、配置mariadb的yum源

1.配置yum源

[root@serer01 ~]# cat /etc/yum.repos.d/mariadb.repo # MariaDB 10.6 CentOS repository list - created 2021-12-27 11:21 UTC # https://mariadb.org/download/ [mariadb] name = MariaDB baseurl = https://mirrors.xtom.com.hk/mariadb/yum/10.6/centos7-amd64 gpgkey=https://mirrors.xtom.com.hk/mariadb/yum/RPM-GPG-KEY-MariaDB gpgcheck=0 enable=1

2.替換中科大的源

sed -i 's#//mirrors.xtom.com.hk#//mirrors.ustc.edu.cn#g' /etc/yum.repos.d/mariadb.repo

三、檢查yum倉庫

1.修改/etc/yum.conf文件

[root@serer01 ~]# grep false /etc/yum.conf sslverify=false

2.檢查yum倉庫

[root@serer01 ~]# yum repolist all |grep enable base/7/x86_64 CentOS-7 - Base - mirrors.a enabled: 10,072 docker-ce-stable/7/x86_64 Docker CE Stable - x86_64 enabled: 183 extras/7/x86_64 CentOS-7 - Extras - mirrors enabled: 515 mariadb MariaDB enabled: 95 updates/7/x86_64 CentOS-7 - Updates - mirror enabled: 4,346

四、安裝mariadb

[root@serer01 ~]# yum -y install Mariadb-server Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile* base: mirrors.aliyun.com* extras: mirrors.aliyun.com* updates: mirrors.aliyun.com No package Mariadb-server available.* Maybe you meant: MariaDB-server, mariadb-server Error: Nothing to do [root@serer01 ~]# yum -y install Mariadb-server --nodeps Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile* base: mirrors.aliyun.com* extras: mirrors.aliyun.com* updates: mirrors.aliyun.com No package Mariadb-server available.* Maybe you meant: MariaDB-server, mariadb-server Error: Nothing to do [root@serer01 ~]# yum -y install MariaDB-server Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile* base: mirrors.aliyun.com* extras: mirrors.aliyun.com* updates: mirrors.aliyun.com Resolving Dependencies --> Running transaction check ---> Package MariaDB-server.x86_64 0:10.6.10-1.el7.centos will be installed --> Processing Dependency: MariaDB-common >= 10.6.1 for package: MariaDB-server-10.6.10-1.el7.centos.x86_64 --> Processing Dependency: MariaDB-client >= 10.6.1 for package: MariaDB-server-10.6.10-1.el7.centos.x86_64 --> Processing Dependency: libpmem.so.1(LIBPMEM_1.0)(64bit) for package: MariaDB-server-10.6.10-1.el7.centos.x86_64 --> Processing Dependency: rsync for package: MariaDB-server-10.6.10-1.el7.centos.x86_64 --> Processing Dependency: galera-4 for package: MariaDB-server-10.6.10-1.el7.centos.x86_64 --> Processing Dependency: libcrypto.so.10(OPENSSL_1.0.2)(64bit) for package: MariaDB-server-10.6.10-1.el7.centos.x86_64 --> Processing Dependency: lsof for package: MariaDB-server-10.6.10-1.el7.centos.x86_64 --> Processing Dependency: libpmem.so.1()(64bit) for package: MariaDB-server-10.6.10-1.el7.centos.x86_64 --> Processing Dependency: libpcre2-8.so.0()(64bit) for package: MariaDB-server-10.6.10-1.el7.centos.x86_64 --> Running transaction check ---> Package MariaDB-client.x86_64 0:10.6.10-1.el7.centos will be installed --> Processing Dependency: perl(DBI) for package: MariaDB-client-10.6.10-1.el7.centos.x86_64 --> Processing Dependency: perl(Data::Dumper) for package: MariaDB-client-10.6.10-1.el7.centos.x86_64 ---> Package MariaDB-common.x86_64 0:10.6.10-1.el7.centos will be installed --> Processing Dependency: MariaDB-compat for package: MariaDB-common-10.6.10-1.el7.centos.x86_64 ---> Package galera-4.x86_64 0:26.4.12-1.el7.centos will be installed --> Processing Dependency: socat for package: galera-4-26.4.12-1.el7.centos.x86_64 --> Processing Dependency: libboost_program_options-mt.so.1.53.0()(64bit) for package: galera-4-26.4.12-1.el7.centos.x86_64 ---> Package libpmem.x86_64 0:1.5.1-2.1.el7 will be installed ---> Package lsof.x86_64 0:4.87-6.el7 will be installed ---> Package openssl-libs.x86_64 1:1.0.1e-42.el7.9 will be updated --> Processing Dependency: openssl-libs(x86-64) = 1:1.0.1e-42.el7.9 for package: 1:openssl-1.0.1e-42.el7.9.x86_64 ---> Package openssl-libs.x86_64 1:1.0.2k-25.el7_9 will be an update ---> Package pcre2.x86_64 0:10.23-2.el7 will be installed ---> Package rsync.x86_64 0:3.1.2-11.el7_9 will be installed --> Running transaction check ---> Package MariaDB-compat.x86_64 0:10.6.10-1.el7.centos will be obsoleting ---> Package boost-program-options.x86_64 0:1.53.0-28.el7 will be installed ---> Package mariadb-libs.x86_64 1:5.5.44-2.el7.centos will be obsoleted ---> Package openssl.x86_64 1:1.0.1e-42.el7.9 will be updated ---> Package openssl.x86_64 1:1.0.2k-25.el7_9 will be an update ---> Package perl-DBI.x86_64 0:1.627-4.el7 will be installed --> Processing Dependency: perl(RPC::PlServer) >= 0.2001 for package: perl-DBI-1.627-4.el7.x86_64 --> Processing Dependency: perl(RPC::PlClient) >= 0.2000 for package: perl-DBI-1.627-4.el7.x86_64 ---> Package perl-Data-Dumper.x86_64 0:2.145-3.el7 will be installed ---> Package socat.x86_64 0:1.7.3.2-2.el7 will be installed --> Running transaction check ---> Package perl-PlRPC.noarch 0:0.2020-14.el7 will be installed --> Processing Dependency: perl(Net::Daemon) >= 0.13 for package: perl-PlRPC-0.2020-14.el7.noarch --> Processing Dependency: perl(Net::Daemon::Test) for package: perl-PlRPC-0.2020-14.el7.noarch --> Processing Dependency: perl(Net::Daemon::Log) for package: perl-PlRPC-0.2020-14.el7.noarch --> Processing Dependency: perl(Compress::Zlib) for package: perl-PlRPC-0.2020-14.el7.noarch --> Running transaction check ---> Package perl-IO-Compress.noarch 0:2.061-2.el7 will be installed --> Processing Dependency: perl(Compress::Raw::Zlib) >= 2.061 for package: perl-IO-Compress-2.061-2.el7.noarch --> Processing Dependency: perl(Compress::Raw::Bzip2) >= 2.061 for package: perl-IO-Compress-2.061-2.el7.noarch ---> Package perl-Net-Daemon.noarch 0:0.48-5.el7 will be installed --> Running transaction check ---> Package perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7 will be installed ---> Package perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7 will be installed --> Finished Dependency ResolutionDependencies Resolved===================================================================================================================================================Package Arch Version Repository Size =================================================================================================================================================== Installing:MariaDB-compat x86_64 10.6.10-1.el7.centos mariadb 2.2 Mreplacing mariadb-libs.x86_64 1:5.5.44-2.el7.centosMariaDB-server x86_64 10.6.10-1.el7.centos mariadb 25 M Installing for dependencies:MariaDB-client x86_64 10.6.10-1.el7.centos mariadb 14 MMariaDB-common x86_64 10.6.10-1.el7.centos mariadb 81 kboost-program-options x86_64 1.53.0-28.el7 base 156 kgalera-4 x86_64 26.4.12-1.el7.centos mariadb 9.9 Mlibpmem x86_64 1.5.1-2.1.el7 base 59 klsof x86_64 4.87-6.el7 base 331 kpcre2 x86_64 10.23-2.el7 base 201 kperl-Compress-Raw-Bzip2 x86_64 2.061-3.el7 base 32 kperl-Compress-Raw-Zlib x86_64 1:2.061-4.el7 base 57 kperl-DBI x86_64 1.627-4.el7 base 802 kperl-Data-Dumper x86_64 2.145-3.el7 base 47 kperl-IO-Compress noarch 2.061-2.el7 base 260 kperl-Net-Daemon noarch 0.48-5.el7 base 51 kperl-PlRPC noarch 0.2020-14.el7 base 36 krsync x86_64 3.1.2-11.el7_9 updates 408 ksocat x86_64 1.7.3.2-2.el7 base 290 k Updating for dependencies:openssl x86_64 1:1.0.2k-25.el7_9 updates 494 kopenssl-libs x86_64 1:1.0.2k-25.el7_9 updates 1.2 MTransaction Summary =================================================================================================================================================== Install 2 Packages (+16 Dependent packages) Upgrade ( 2 Dependent packages)Total download size: 56 M Downloading packages: Delta RPMs disabled because /usr/bin/applydeltarpm not installed. (1/20): MariaDB-common-10.6.10-1.el7.centos.x86_64.rpm | 81 kB 00:00:00 (2/20): MariaDB-compat-10.6.10-1.el7.centos.x86_64.rpm | 2.2 MB 00:00:00 (3/20): MariaDB-client-10.6.10-1.el7.centos.x86_64.rpm | 14 MB 00:00:01 (4/20): boost-program-options-1.53.0-28.el7.x86_64.rpm | 156 kB 00:00:00 (5/20): libpmem-1.5.1-2.1.el7.x86_64.rpm | 59 kB 00:00:00 (6/20): openssl-1.0.2k-25.el7_9.x86_64.rpm | 494 kB 00:00:00 (7/20): pcre2-10.23-2.el7.x86_64.rpm | 201 kB 00:00:00 (8/20): perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64.rpm | 32 kB 00:00:00 (9/20): perl-Compress-Raw-Zlib-2.061-4.el7.x86_64.rpm | 57 kB 00:00:00 (10/20): openssl-libs-1.0.2k-25.el7_9.x86_64.rpm | 1.2 MB 00:00:00 (11/20): perl-DBI-1.627-4.el7.x86_64.rpm | 802 kB 00:00:00 (12/20): perl-Data-Dumper-2.145-3.el7.x86_64.rpm | 47 kB 00:00:00 (13/20): perl-IO-Compress-2.061-2.el7.noarch.rpm | 260 kB 00:00:00 (14/20): perl-Net-Daemon-0.48-5.el7.noarch.rpm | 51 kB 00:00:00 (15/20): perl-PlRPC-0.2020-14.el7.noarch.rpm | 36 kB 00:00:00 (16/20): socat-1.7.3.2-2.el7.x86_64.rpm | 290 kB 00:00:00 (17/20): lsof-4.87-6.el7.x86_64.rpm | 331 kB 00:00:00 (18/20): rsync-3.1.2-11.el7_9.x86_64.rpm | 408 kB 00:00:00 (19/20): MariaDB-server-10.6.10-1.el7.centos.x86_64.rpm | 25 MB 00:00:02 (20/20): galera-4-26.4.12-1.el7.centos.x86_64.rpm | 9.9 MB 00:00:01 --------------------------------------------------------------------------------------------------------------------------------------------------- Total 19 MB/s | 56 MB 00:00:02 Running transaction check Running transaction test Transaction test succeeded Running transactionUpdating : 1:openssl-libs-1.0.2k-25.el7_9.x86_64 1/23 Installing : pcre2-10.23-2.el7.x86_64 2/23 Installing : libpmem-1.5.1-2.1.el7.x86_64 3/23 Installing : perl-Data-Dumper-2.145-3.el7.x86_64 4/23 Installing : rsync-3.1.2-11.el7_9.x86_64 5/23 Installing : lsof-4.87-6.el7.x86_64 6/23 Updating : 1:openssl-1.0.2k-25.el7_9.x86_64 7/23 Installing : MariaDB-common-10.6.10-1.el7.centos.x86_64 8/23 Installing : MariaDB-compat-10.6.10-1.el7.centos.x86_64 9/23 Installing : socat-1.7.3.2-2.el7.x86_64 10/23 Installing : perl-Net-Daemon-0.48-5.el7.noarch 11/23 Installing : 1:perl-Compress-Raw-Zlib-2.061-4.el7.x86_64 12/23 Installing : perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64 13/23 Installing : perl-IO-Compress-2.061-2.el7.noarch 14/23 Installing : perl-PlRPC-0.2020-14.el7.noarch 15/23 Installing : perl-DBI-1.627-4.el7.x86_64 16/23 Installing : MariaDB-client-10.6.10-1.el7.centos.x86_64 17/23 Installing : boost-program-options-1.53.0-28.el7.x86_64 18/23 Installing : galera-4-26.4.12-1.el7.centos.x86_64 19/23 Installing : MariaDB-server-10.6.10-1.el7.centos.x86_64 20/23 Two all-privilege accounts were created. One is root@localhost, it has no password, but you need to be system 'root' user to connect. Use, for example, sudo mysql The second is mysql@localhost, it has no password either, but you need to be the system 'mysql' user to connect. After connecting you can set the password, if you would need to be able to connect as any of these users with a password and without sudoSee the MariaDB Knowledgebase at https://mariadb.com/kbPlease report any problems at https://mariadb.org/jiraThe latest information about MariaDB is available at https://mariadb.org/.Consider joining MariaDB's strong and vibrant community: https://mariadb.org/get-involved/Erasing : 1:mariadb-libs-5.5.44-2.el7.centos.x86_64 21/23 Cleanup : 1:openssl-1.0.1e-42.el7.9.x86_64 22/23 Cleanup : 1:openssl-libs-1.0.1e-42.el7.9.x86_64 23/23 Verifying : boost-program-options-1.53.0-28.el7.x86_64 1/23 Verifying : 1:openssl-1.0.2k-25.el7_9.x86_64 2/23 Verifying : lsof-4.87-6.el7.x86_64 3/23 Verifying : MariaDB-server-10.6.10-1.el7.centos.x86_64 4/23 Verifying : perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64 5/23 Verifying : rsync-3.1.2-11.el7_9.x86_64 6/23 Verifying : MariaDB-compat-10.6.10-1.el7.centos.x86_64 7/23 Verifying : MariaDB-client-10.6.10-1.el7.centos.x86_64 8/23 Verifying : perl-Data-Dumper-2.145-3.el7.x86_64 9/23 Verifying : perl-DBI-1.627-4.el7.x86_64 10/23 Verifying : libpmem-1.5.1-2.1.el7.x86_64 11/23 Verifying : pcre2-10.23-2.el7.x86_64 12/23 Verifying : galera-4-26.4.12-1.el7.centos.x86_64 13/23 Verifying : 1:openssl-libs-1.0.2k-25.el7_9.x86_64 14/23 Verifying : 1:perl-Compress-Raw-Zlib-2.061-4.el7.x86_64 15/23 Verifying : perl-Net-Daemon-0.48-5.el7.noarch 16/23 Verifying : perl-IO-Compress-2.061-2.el7.noarch 17/23 Verifying : perl-PlRPC-0.2020-14.el7.noarch 18/23 Verifying : MariaDB-common-10.6.10-1.el7.centos.x86_64 19/23 Verifying : socat-1.7.3.2-2.el7.x86_64 20/23 Verifying : 1:mariadb-libs-5.5.44-2.el7.centos.x86_64 21/23 Verifying : 1:openssl-libs-1.0.1e-42.el7.9.x86_64 22/23 Verifying : 1:openssl-1.0.1e-42.el7.9.x86_64 23/23 Installed:MariaDB-compat.x86_64 0:10.6.10-1.el7.centos MariaDB-server.x86_64 0:10.6.10-1.el7.centos Dependency Installed:MariaDB-client.x86_64 0:10.6.10-1.el7.centos MariaDB-common.x86_64 0:10.6.10-1.el7.centos boost-program-options.x86_64 0:1.53.0-28.el7 galera-4.x86_64 0:26.4.12-1.el7.centos libpmem.x86_64 0:1.5.1-2.1.el7 lsof.x86_64 0:4.87-6.el7 pcre2.x86_64 0:10.23-2.el7 perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7 perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7 perl-DBI.x86_64 0:1.627-4.el7 perl-Data-Dumper.x86_64 0:2.145-3.el7 perl-IO-Compress.noarch 0:2.061-2.el7 perl-Net-Daemon.noarch 0:0.48-5.el7 perl-PlRPC.noarch 0:0.2020-14.el7 rsync.x86_64 0:3.1.2-11.el7_9 socat.x86_64 0:1.7.3.2-2.el7 Dependency Updated:openssl.x86_64 1:1.0.2k-25.el7_9 openssl-libs.x86_64 1:1.0.2k-25.el7_9 Replaced:mariadb-libs.x86_64 1:5.5.44-2.el7.centos Complete!

五、啟動mariadb服務

1.啟動mariadb服務

[root@serer01 ~]# systemctl enable --now mariadb Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.

2.查看mariadb服務狀態(tài)

[root@serer01 ~]# systemctl status mariadb ● mariadb.service - MariaDB 10.6.10 database serverLoaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)Drop-In: /etc/systemd/system/mariadb.service.d└─migrated-from-my.cnf-settings.confActive: active (running) since Fri 2022-11-04 22:50:42 CST; 38s agoDocs: man:mariadbd(8)https://mariadb.com/kb/en/library/systemd/Process: 13728 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)Process: 13702 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= || VAR=`cd /usr/bin/..; /usr/bin/galera_recovery`; [ $? -eq 0 ] && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1 (code=exited, status=0/SUCCESS)Process: 13700 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)Main PID: 13714 (mariadbd)Status: "Taking your SQL requests now..."Memory: 61.3MCGroup: /system.slice/mariadb.service└─13714 /usr/sbin/mariadbdNov 04 22:50:42 serer01 mariadbd[13714]: 2022-11-04 22:50:42 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB. Nov 04 22:50:42 serer01 mariadbd[13714]: 2022-11-04 22:50:42 0 [Note] InnoDB: 10.6.10 started; log sequence number 42132; transaction id 14 Nov 04 22:50:42 serer01 mariadbd[13714]: 2022-11-04 22:50:42 0 [Note] Plugin 'FEEDBACK' is disabled. Nov 04 22:50:42 serer01 mariadbd[13714]: 2022-11-04 22:50:42 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool Nov 04 22:50:42 serer01 mariadbd[13714]: 2022-11-04 22:50:42 0 [Note] InnoDB: Buffer pool(s) load completed at 221104 22:50:42 Nov 04 22:50:42 serer01 mariadbd[13714]: 2022-11-04 22:50:42 0 [Note] Server socket created on IP: '0.0.0.0'. Nov 04 22:50:42 serer01 mariadbd[13714]: 2022-11-04 22:50:42 0 [Note] Server socket created on IP: '::'. Nov 04 22:50:42 serer01 mariadbd[13714]: 2022-11-04 22:50:42 0 [Note] /usr/sbin/mariadbd: ready for connections. Nov 04 22:50:42 serer01 mariadbd[13714]: Version: '10.6.10-MariaDB' socket: '/var/lib/mysql/mysql.sock' port: 3306 MariaDB Server Nov 04 22:50:42 serer01 systemd[1]: Started MariaDB 10.6.10 database server.

六、mariadb的遠程連接

1.本地連接

[root@serer01 ~]# mysql Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 3 Server version: 10.6.10-MariaDB MariaDB ServerCopyright (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)]> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | sys | | test | +--------------------+ 5 rows in set (0.002 sec)MariaDB [(none)]>

2.創(chuàng)建用戶

MariaDB [(none)]> CREATE USER 'admin'@'%' IDENTIFIED BY 'admin123456'; Query OK, 0 rows affected (0.021 sec)MariaDB [(none)]>

3.對用戶授權(quán)

MariaDB [(none)]> grant all on *.* to 'admin'@'%' with grant option; Query OK, 0 rows affected (0.020 sec)MariaDB [(none)]> flush privileges; Query OK, 0 rows affected (0.001 sec)MariaDB [(none)]>

4.測試遠程連接mariadb數(shù)據(jù)庫

[root@serer01 ~]# mysql -h 192.168.3.169 -P3306 -uadmin -padmin123456 Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 5 Server version: 10.6.10-MariaDB MariaDB ServerCopyright (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)]>

總結(jié)

以上是生活随笔為你收集整理的Linux系统之安装mariadb方法的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。