从命令行连接到 MariaDB

01 现在,输入以下命令以 root 帐户通过终端连接到 MariaDB 服务器:

$mysql -u root -p

02 最后输入root用户账号的密码,就会得到MariaDB的shell,如下图:

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 18
Server version: 10.3.11-MariaDB MariaDB Server
Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>

保护 MariaDB 服务器

MariaDB 服务器包附带了一个名为“mysql_secure_installation”的脚本,该脚本执行多项与安全相关的操作,并设置 root 密码。

如何在 CentOS 8 上安装 MariaDB

MariaDB 是一个开源的关系数据库管理系统,二进制向后兼容,替代 MySQL。
此外,它是由 MySQL 的一些原始开发人员和社区的许多贡献者开发的。

在本教程中,我们将解释如何在 CentOS 8 上安装和保护 MariaDB 10.

在 CentOS 8 上安装 MariaDB

01 以 root 或者具有 sudo权限的用户身份运行以下命令,在 CentOS 8 上安装 MariaDB 10.3:

$sudo dnf install @mariadb

02 安装完成后,启动 MariaDB 服务并通过键入以下命令使其在启动时自动启动:

$sudo systemctl enable --now mariadb

03 要验证 MariaDB 服务器是否正在运行,执行:

$sudo systemctl status mariadb
日期:2020-06-02 22:18:16 来源:oir作者:oir