`

MySQL安全配置向导mysql_secure_installation详解

    博客分类:
  • sql
阅读更多

安装完mysql-server 会提示可以运行mysql_secure_installation。运行mysql_secure_installation会执行几个设置:
  a)为root用户设置密码
  b)删除匿名账号
  c)取消root用户远程登录
  d)删除test库和对test库的访问权限
  e)刷新授权表使修改生效

 

通过这几项的设置能够提高mysql库的安全。建议生产环境中mysql安装这完成后一定要运行一次mysql_secure_installation,详细步骤请参看下面的命令:

[root@dns ~]# mysql_secure_installation
/usr/bin/mysql_secure_installation:行379: find_mysql_client: 未找到命令

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.

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
Enter current password for root (enter for none):   -->初次运行直接enter
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] 
 ... 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] 
 - 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] 
 ... 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!

 

分享到:
评论

相关推荐

    MySQL安装配置教程及功能优势详解.docx

    sudo mysql_secure_installation ``` 按照提示设置root用户的密码,并根据需要进行其他安全设置,如删除匿名用户、禁止远程root登录、移除测试数据库等。 #### 三、MySQL配置 MySQL的配置可以通过修改配置文件...

    mysql安装配置教程2.docx

    - **运行安全配置脚本**:输入`sudo mysql_secure_installation`并按回车键。 - **设置root密码**:根据提示设置root用户的密码,并对其他安全性选项进行配置,如移除匿名用户、禁止root用户远程登录等。 ##### 4. ...

    MySQL数据库的安装配置(Linux+Windows超详细)

    - 使用 `mysql_secure_installation` 脚本来增强安全性。 ```sh sudo mysql_secure_installation ``` - 在此过程中,您将被提示设置 MySQL root 用户的密码、移除匿名用户、禁止 root 远程登录以及移除测试...

    mysql安装配置教程

    5. **安全配置MySQL**:使用命令`sudo mysql_secure_installation`对MySQL进行安全性配置,包括更改root用户的密码、移除匿名用户、禁止远程root登录等。 #### 四、验证MySQL安装 - **启动MySQL服务**:在命令行中...

    mysql安装配置教程.docx

    ### MySQL安装配置教程知识点详解 #### 一、MySQL简介与应用背景 MySQL作为一个广为人知且备受推崇的开源关系型数据库管理系统(RDBMS),在众多业务场景中扮演着核心角色。它支持标准的SQL查询语言,具备高性能、...

    Linux SecureCRT显示乱码解决方案

    - **MySQL安全配置向导mysql_secure_installation详解**:这个向导可以帮助用户在安装MySQL后进行必要的安全设置,如更改root用户的密码,删除匿名用户等。 - **PHP的setcookie函数**:用于设置HTTP Cookie,包括...

    MYSQL 安装方法详解

    3. **配置安全选项**:安装完成后,运行`mysql_secure_installation`脚本来增强MySQL的安全性。这包括设置root密码、禁用远程root登录等操作。 4. **检查服务状态**:使用`sudo systemctl status mysql`命令查看...

    MySQL 数据库安装与配置教程.docx

    - **安全配置** - 运行 `mysql_secure_installation` 脚本来增强 MySQL 的安全性,包括设置 root 密码、移除匿名用户、禁止 root 远程登录等。 ```bash sudo mysql_secure_installation ``` - **启动服务** - ...

    mysql5.6以及mysql简易安装办法

    - **安全配置**:安装完成后,务必通过 `mysql_secure_installation` 命令进行安全性配置,以增强系统的安全性。 - **权限设置**:确保 MySQL 服务运行所需的用户权限正确配置,避免权限不足导致的问题。 - **性能...

    安装和配置 MySQL 可以分为几个步骤,涵盖下载、安装、基本配置和测试连接.docx

    ### MySQL 安装与配置详解 #### 一、在 Windows 上安装 MySQL ##### 1. 下载 MySQL 安装包 - **访问 MySQL 官网**:首先打开 MySQL 官方下载页面([MySQL Downloads](https://dev.mysql.com/downloads/installer/...

    mysql5.0安装教程(图文详解).pdf

    - **安全性配置**:运行mysql_secure_installation脚本来设置root密码,删除匿名用户,禁止root远程登录等。 - **服务管理**:学习如何启动、停止MySQL服务,设置服务开机自启等。 #### 5. 图形界面工具 - **MySQL ...

    mysql 安装 导出SQL

    - 使用`mysql_secure_installation`命令增强安全性,如删除匿名用户、禁止root远程登录等。 5. **测试MySQL服务**: - 通过命令行或图形界面工具(如MySQL Workbench、phpMyAdmin等)连接MySQL服务器,验证是否...

    在Linux系统安装MySql步骤截图详解

    安装完成后,为了增强安全性,需要运行MySQL的安全配置向导,通常使用`mysql_secure_installation`命令。该向导将引导你完成设置root用户的强密码、删除匿名用户、禁止root远程登录等安全步骤。 以上就是在Linux...

    mysql install

    mysql_secure_installation ``` 按照提示设置新密码、删除匿名用户、禁止远程root登录、删除测试数据库并刷新权限。 五、验证安装 1. 打开命令行工具,输入以下命令连接MySQL(替换'your_password'为你的root...

    安装和JDBC连接mysql

    - **安全配置**:通过`mysql_secure_installation`命令进行安全配置,包括设置root账户的密码、删除匿名用户等。 #### 二、JDBC驱动的安装与配置 **2.1 下载JDBC驱动** 文中提到了下载MySQL的JDBC驱动程序。JDBC...

    mysql安装包

    3. **初始化配置**:通过命令`mysql_secure_installation`进行安全性配置。 4. **启动服务**:使用`sudo service mysql start`命令启动MySQL服务。 #### 在macOS上安装MySQL 1. **安装Homebrew**:首先确保已经安装...

Global site tag (gtag.js) - Google Analytics