MySQL安全配置向导mysql_secure_installation详解

 更新时间:2014年03月06日 09:02:54   投稿:junjie  
这篇文章主要介绍了MySQL安全配置向导mysql_secure_installation各项配置的含义,并依据经验给予一了一些建议,需要的朋友可以参考下

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

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

复制代码 代码如下:

[root@server1 ~]# mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MySQL to secure it, we'll need the current
password for the root user. If you've just installed MySQL, 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 MySQL
root user without the proper authorisation.
Set root password? [Y/n] <– 是否设置root用户密码,输入y并回车或直接回车
New password: <– 设置root用户的密码
Re-enter new password: <– 再输入一次你设置的密码
Password updated successfully!
Reloading privilege tables..
… Success!
By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL 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] <– 是否删除匿名用户,生产环境建议删除,所以直接回车
… 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] <–是否禁止root远程登录,根据自己的需求选择Y/n并回车,建议禁止
… Success!
By default, MySQL 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] <– 是否删除test数据库,直接回车
- 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 MySQL
installation should now be secure.
Thanks for using MySQL!
[root@server1 ~]#

相关文章

  • MySQL 8.0.23 主要更新一览(新特征解读)

    MySQL 8.0.23 主要更新一览(新特征解读)

    这篇文章主要介绍了MySQL 8.0.23 主要更新一览(新特征解读),需要的朋友可以参考下
    2021-01-01
  • net start mysql服务名无效的三种解决方法

    net start mysql服务名无效的三种解决方法

    这篇文章主要介绍了net start mysql服务名无效的三种解决方法,通过图文结合的方式讲解的非常详细,对大家的学习或工作有一定的帮助,需要的朋友可以参考下
    2024-08-08
  • MySQL定时器EVENT学习笔记

    MySQL定时器EVENT学习笔记

    本文为大家介绍下MySQL定时器EVENT,要使定时起作用 MySQL的常量GLOBAL event_scheduler必须为on或者是1,感兴趣的朋友可以了解下
    2013-11-11
  • MySQL 使用事件(Events)完成计划任务

    MySQL 使用事件(Events)完成计划任务

    事件(Events) 是在 MySQL 5.1后引入的,有点类似操作系统的计划任务(cron),但是周期性任务是内置在 MySQL 服务端执行的。本文讲述MySQL如何用事件完成计划任务
    2021-05-05
  • mysql设置默认值无效问题及解决

    mysql设置默认值无效问题及解决

    这篇文章主要介绍了mysql设置默认值无效问题及解决方案,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教
    2023-10-10
  • MySQL left join操作中on和where放置条件的区别介绍

    MySQL left join操作中on和where放置条件的区别介绍

    这篇文章主要给大家介绍了关于MySQL left join操作中on和where放置条件的区别的相关资料,文中通过示例代码介绍的非常详细,需要的朋友可以参考借鉴,下面随着小编来一起学习学习吧
    2019-01-01
  • mysql 8.0.22 下载安装配置方法图文教程

    mysql 8.0.22 下载安装配置方法图文教程

    这篇文章主要为大家详细介绍了mysql 8.0.22 下载安装配置方法图文教程,文中安装步骤介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
    2020-11-11
  • MySql 查询符合条件的最新数据行

    MySql 查询符合条件的最新数据行

    这篇文章主要介绍了MySql 怎么查出符合条件的最新的数据行,本文通过示例代码给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下
    2022-07-07
  • MySQL按时间统计数据的方法总结

    MySQL按时间统计数据的方法总结

    在本篇MYSQL的内容里,我们给大家整理了关于按时间统计数据的方法内容,有需要的朋友们学习下。
    2019-02-02
  • 解析SQL Server 视图、数据库快照

    解析SQL Server 视图、数据库快照

    在程序开发过程中,任何一个项目都离不开数据库,这篇文章给大家详细介绍SQL Server 视图、数据库快照相关内容,需要的朋友可以参考下
    2015-08-08

最新评论