[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: rsyncfor 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: lsoffor 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.2001for package: perl-DBI-1.627-4.el7.x86_64
--> Processing Dependency: perl(RPC::PlClient)>=0.2000for 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.13for 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.061for package: perl-IO-Compress-2.061-2.el7.noarch
--> Processing Dependency: perl(Compress::Raw::Bzip2)>=2.061for 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服务状态
[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: 13728ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)Process: 13702ExecStartPre=/bin/sh -c[!-e /usr/bin/galera_recovery ]&&VAR=||VAR=`cd /usr/bin/..; /usr/bin/galera_recovery`;[$?-eq0]&& systemctl set-environment _WSREP_START_POSITION=$VAR||exit1(code=exited, status=0/SUCCESS)Process: 13700ExecStartPre=/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 id14
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 22110422: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 inset(0.002 sec)MariaDB [(none)]>
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数据库
[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)]>