码迷,mamicode.com
首页 > 数据库 > 详细

Centos8安装mariaDB

时间:2021-07-05 16:58:36      阅读:0      评论:0      收藏:0      [点我收藏+]

标签:repo   cli   usr   als   move   resolved   out   not   testing   

[root@NMS src]#  yum search mariadb
Last metadata expiration check: 0:46:24 ago on Fri 02 Jul 2021 08:18:32 PM CST.
==================================================== Name Exactly Matched: mariadb =====================================================
mariadb.x86_64 : A very fast and robust SQL database server
=================================================== Name & Summary Matched: mariadb ====================================================
mariadb-connector-c.i686 : The MariaDB Native Client library (C driver)
mariadb-connector-c.x86_64 : The MariaDB Native Client library (C driver)
mariadb-connector-c-devel.i686 : Development files for mariadb-connector-c
mariadb-connector-c-devel.x86_64 : Development files for mariadb-connector-c
mariadb-connector-odbc.x86_64 : The MariaDB Native Client library (ODBC driver)
mariadb-devel.x86_64 : Files for development of MariaDB/MySQL applications
mariadb-embedded.x86_64 : MariaDB as an embeddable library
mariadb-embedded-devel.x86_64 : Development files for MariaDB as an embeddable library
mariadb-java-client.noarch : Connects applications developed in Java to MariaDB and MySQL databases
mariadb-oqgraph-engine.x86_64 : The Open Query GRAPH engine for MariaDB
mariadb-server.x86_64 : The MariaDB server and related files
mariadb-server-utils.x86_64 : Non-essential server utilities for MariaDB/MySQL applications
mariadb-test.x86_64 : The test suite distributed with MariaDB
======================================================== Name Matched: mariadb =========================================================
mariadb-backup.x86_64 : The mariabackup tool for physical online backups
mariadb-common.x86_64 : The shared files required by server and client
mariadb-connector-c-config.noarch : Configuration files for packages that use /etc/my.cnf as a configuration file
mariadb-errmsg.x86_64 : The error messages files required by server and embedded
mariadb-gssapi-server.x86_64 : GSSAPI authentication plugin for server
mariadb-server-galera.x86_64 : The configuration files and scripts for galera replication
======================================================= Summary Matched: mariadb =======================================================
mysql-selinux.noarch : SELinux policy modules for MySQL and MariaDB packages
[root@NMS src]# yum install mariadb-server
Last metadata expiration check: 0:47:16 ago on Fri 02 Jul 2021 08:18:32 PM CST.
Dependencies resolved.
========================================================================================================================================
 Package                               Architecture      Version                                             Repository            Size
========================================================================================================================================
Installing:
 mariadb-server                        x86_64            3:10.3.28-1.module_el8.3.0+757+d382997d             AppStream             16 M
Installing dependencies:
 mariadb                               x86_64            3:10.3.28-1.module_el8.3.0+757+d382997d             AppStream            6.0 M
 mariadb-common                        x86_64            3:10.3.28-1.module_el8.3.0+757+d382997d             AppStream             64 k
 mariadb-connector-c                   x86_64            3.1.11-2.el8_3                                      AppStream            200 k
 mariadb-connector-c-config            noarch            3.1.11-2.el8_3                                      AppStream             15 k
 mariadb-errmsg                        x86_64            3:10.3.28-1.module_el8.3.0+757+d382997d             AppStream            234 k
 perl-DBD-MySQL                        x86_64            4.046-3.module_el8.1.0+203+e45423dc                 AppStream            156 k
Installing weak dependencies:
 mariadb-backup                        x86_64            3:10.3.28-1.module_el8.3.0+757+d382997d             AppStream            6.1 M
 mariadb-gssapi-server                 x86_64            3:10.3.28-1.module_el8.3.0+757+d382997d             AppStream             51 k
 mariadb-server-utils                  x86_64            3:10.3.28-1.module_el8.3.0+757+d382997d             AppStream            1.1 M
Enabling module streams:
 mariadb                                                 10.3                                                                          
 perl-DBD-MySQL                                          4.046                                                                         

Transaction Summary
========================================================================================================================================
Install  10 Packages

Total download size: 30 M
Installed size: 153 M
Is this ok [y/N]: y
Downloading Packages:
(1/10): mariadb-common-10.3.28-1.module_el8.3.0+757+d382997d.x86_64.rpm                                 230 kB/s |  64 kB     00:00    
(2/10): mariadb-connector-c-3.1.11-2.el8_3.x86_64.rpm                                                   981 kB/s | 200 kB     00:00    
(3/10): mariadb-connector-c-config-3.1.11-2.el8_3.noarch.rpm                                            242 kB/s |  15 kB     00:00    
(4/10): mariadb-errmsg-10.3.28-1.module_el8.3.0+757+d382997d.x86_64.rpm                                 664 kB/s | 234 kB     00:00    
(5/10): mariadb-gssapi-server-10.3.28-1.module_el8.3.0+757+d382997d.x86_64.rpm                          428 kB/s |  51 kB     00:00    
(6/10): mariadb-10.3.28-1.module_el8.3.0+757+d382997d.x86_64.rpm                                        3.4 MB/s | 6.0 MB     00:01    
(7/10): mariadb-backup-10.3.28-1.module_el8.3.0+757+d382997d.x86_64.rpm                                 3.3 MB/s | 6.1 MB     00:01    
(8/10): perl-DBD-MySQL-4.046-3.module_el8.1.0+203+e45423dc.x86_64.rpm                                   1.0 MB/s | 156 kB     00:00    
(9/10): mariadb-server-utils-10.3.28-1.module_el8.3.0+757+d382997d.x86_64.rpm                           2.3 MB/s | 1.1 MB     00:00    
(10/10): mariadb-server-10.3.28-1.module_el8.3.0+757+d382997d.x86_64.rpm                                3.9 MB/s |  16 MB     00:04    
----------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                   5.8 MB/s |  30 MB     00:05     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                1/1 
  Installing       : mariadb-connector-c-config-3.1.11-2.el8_3.noarch                                                              1/10 
  Installing       : mariadb-common-3:10.3.28-1.module_el8.3.0+757+d382997d.x86_64                                                 2/10 
  Installing       : mariadb-errmsg-3:10.3.28-1.module_el8.3.0+757+d382997d.x86_64                                                 3/10 
  Installing       : perl-DBD-MySQL-4.046-3.module_el8.1.0+203+e45423dc.x86_64                                                     4/10 
  Installing       : mariadb-connector-c-3.1.11-2.el8_3.x86_64                                                                     5/10 
  Installing       : mariadb-backup-3:10.3.28-1.module_el8.3.0+757+d382997d.x86_64                                                 6/10 
  Installing       : mariadb-gssapi-server-3:10.3.28-1.module_el8.3.0+757+d382997d.x86_64                                          7/10 
  Installing       : mariadb-server-utils-3:10.3.28-1.module_el8.3.0+757+d382997d.x86_64                                           8/10 
  Running scriptlet: mariadb-server-3:10.3.28-1.module_el8.3.0+757+d382997d.x86_64                                                 9/10 
  Installing       : mariadb-server-3:10.3.28-1.module_el8.3.0+757+d382997d.x86_64                                                 9/10 
  Running scriptlet: mariadb-server-3:10.3.28-1.module_el8.3.0+757+d382997d.x86_64                                                 9/10 
  Installing       : mariadb-3:10.3.28-1.module_el8.3.0+757+d382997d.x86_64                                                       10/10 
  Running scriptlet: mariadb-3:10.3.28-1.module_el8.3.0+757+d382997d.x86_64                                                       10/10 
  Verifying        : mariadb-3:10.3.28-1.module_el8.3.0+757+d382997d.x86_64                                                        1/10 
  Verifying        : mariadb-backup-3:10.3.28-1.module_el8.3.0+757+d382997d.x86_64                                                 2/10 
  Verifying        : mariadb-common-3:10.3.28-1.module_el8.3.0+757+d382997d.x86_64                                                 3/10 
  Verifying        : mariadb-connector-c-3.1.11-2.el8_3.x86_64                                                                     4/10 
  Verifying        : mariadb-connector-c-config-3.1.11-2.el8_3.noarch                                                              5/10 
  Verifying        : mariadb-errmsg-3:10.3.28-1.module_el8.3.0+757+d382997d.x86_64                                                 6/10 
  Verifying        : mariadb-gssapi-server-3:10.3.28-1.module_el8.3.0+757+d382997d.x86_64                                          7/10 
  Verifying        : mariadb-server-3:10.3.28-1.module_el8.3.0+757+d382997d.x86_64                                                 8/10 
  Verifying        : mariadb-server-utils-3:10.3.28-1.module_el8.3.0+757+d382997d.x86_64                                           9/10 
  Verifying        : perl-DBD-MySQL-4.046-3.module_el8.1.0+203+e45423dc.x86_64                                                    10/10 
Installed products updated.

Installed:
  mariadb-3:10.3.28-1.module_el8.3.0+757+d382997d.x86_64                 mariadb-backup-3:10.3.28-1.module_el8.3.0+757+d382997d.x86_64  
  mariadb-common-3:10.3.28-1.module_el8.3.0+757+d382997d.x86_64          mariadb-connector-c-3.1.11-2.el8_3.x86_64                      
  mariadb-connector-c-config-3.1.11-2.el8_3.noarch                       mariadb-errmsg-3:10.3.28-1.module_el8.3.0+757+d382997d.x86_64  
  mariadb-gssapi-server-3:10.3.28-1.module_el8.3.0+757+d382997d.x86_64   mariadb-server-3:10.3.28-1.module_el8.3.0+757+d382997d.x86_64  
  mariadb-server-utils-3:10.3.28-1.module_el8.3.0+757+d382997d.x86_64    perl-DBD-MySQL-4.046-3.module_el8.1.0+203+e45423dc.x86_64      

Complete!
[root@NMS src]# systemctl start mariadb.service 
[root@NMS src]# systemctl enable mariadb
mariadb@          mariadb.service   mariadb@.service  
[root@NMS src]# systemctl enable mariadb
Created symlink /etc/systemd/system/mysql.service → /usr/lib/systemd/system/mariadb.service.
Created symlink /etc/systemd/system/mysqld.service → /usr/lib/systemd/system/mariadb.service.
Created symlink /etc/systemd/system/multi-user.target.wants/mariadb.service → /usr/lib/systemd/system/mariadb.service.
[root@NMS src]# mysql_se
mysql_secure_installation  mysql_setpermission        
[root@NMS src]# mysql_secure_installation 

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, well need the current
password for the root user.  If youve just installed MariaDB, and
you havent set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): 
ERROR 1045 (28000): Access denied for user root@localhost (using password: YES)
Enter current password for root (enter for none): 
ERROR 1045 (28000): Access denied for user root@localhost (using password: YES)
Enter current password for root (enter for none): 
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] y
New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
 ... Success!

Normally, root should only be allowed to connect from localhost.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] n
 ... skipping.

By default, MariaDB comes with a database named test that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] n
 ... skipping.

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
 ... Success!

Cleaning up...

All done!  If youve completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!
[root@NMS src]# mysql -u root p
ERROR 1045 (28000): Access denied for user root@localhost (using password: NO)
[root@NMS src]# mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 16
Server version: 10.3.28-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)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
+--------------------+
3 rows in set (0.000 sec)

MariaDB [(none)]> select user,host from mysql.user;
+------+-----------+
| user | host      |
+------+-----------+
| root | 127.0.0.1 |
| root | ::1       |
| root | localhost |
| root | nms       |
+------+-----------+
4 rows in set (0.000 sec)

MariaDB [(none)]> GRANT ALL PRIVILEGES ON *.* TO root@% IDENTIFIED BY P@ssw0rd WITH GRANT OPTION;
Query OK, 0 rows affected (0.000 sec)

MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.000 sec)

MariaDB [(none)]> select user,host from mysql.user;
+------+-----------+
| user | host      |
+------+-----------+
| root | %         |
| root | 127.0.0.1 |
| root | ::1       |
| root | localhost |
| root | nms       |
+------+-----------+
5 rows in set (0.000 sec)

MariaDB [(none)]> quit
Bye

 

Centos8安装mariaDB

标签:repo   cli   usr   als   move   resolved   out   not   testing   

原文地址:https://www.cnblogs.com/zl6536/p/14964919.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有
迷上了代码!