安装部署MariaDB数据库管理系统

目录

一、初始化MariaDB服务

1、安装、启动数据库服务程序、将服务加入开机启动项中。

2、为保证数据库安全性和正常运转,需要对数据库程序进行初始化操作。

3、配置防火墙,放行对数据库服务程序的访问请求,允许管理员root能远程访问数据库。

4、登录MariaDB数据库。

5、修改管理员密码


数据库是指按照特定结构来存储数据的数据仓库。

数据库管理系统是一种能对数据库中存放的数据进行建立、修改、删除、查找、维护等操作的软件程序。

一、初始化MariaDB服务

1、安装、启动数据库服务程序、将服务加入开机启动项中。

root@localhost ~]# yum install mariadb mariadb-server -y 
[root@localhost ~]# systemctl start mariadb 
[root@localhost ~]# systemctl enable mariadb 
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.

2、为保证数据库安全性和正常运转,需要对数据库程序进行初始化操作。

5个步骤

步骤一:设置root管理员在数据库中的密码值

步骤二:设置root管理员在数据库中的专有密码。

步骤三: 随后删除匿名账户,并使用root管理员从远程登录数据库,以确保数据库上运行的业

务的安全性。

步骤四:删除默认的测试数据库,取消测试数据库的一系列访问权限。

步骤五:刷新授权列表,让初始化的设定立即生效。

[root@localhost ~]# 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, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't 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): 
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: 
Sorry, passwords do not match.

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] y
 ... Success!

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] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

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 you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!
[root@localhost ~]# 

3、配置防火墙,放行对数据库服务程序的访问请求,允许管理员root能远程访问数据库。

数据库服务程序默认使用的是3306端口。

4、登录MariaDB数据库。

-u 参数用来指定以 root 管理员的身份登录,

而-p参数用来验证该用户在数据库中的密码值。

5、修改管理员密码

相关推荐

  1. 使用MariaDB数据库管理系统

    2024-04-02 20:52:03       39 阅读
  2. docker安装mariadb数据库

    2024-04-02 20:52:03       21 阅读
  3. 三、 mariadb数据库用户管理

    2024-04-02 20:52:03       22 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-04-02 20:52:03       16 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-04-02 20:52:03       16 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-04-02 20:52:03       15 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-04-02 20:52:03       18 阅读

热门阅读

  1. 两两交换链表中的节点

    2024-04-02 20:52:03       13 阅读
  2. 2024.2.15力扣每日一题——二叉树的层序遍历2

    2024-04-02 20:52:03       16 阅读
  3. Android invalidate、postInvalidate、requestLayout的区别

    2024-04-02 20:52:03       12 阅读
  4. FastAPI Web框架教程 第11章 请求响应的进阶用法

    2024-04-02 20:52:03       14 阅读
  5. 蓝桥杯刷题记录之质数

    2024-04-02 20:52:03       11 阅读
  6. nignx的功能包括哪些

    2024-04-02 20:52:03       13 阅读