MySQL的安全问题从安装开始说起

 更新时间:2013年04月10日 17:46:39   作者:  
本篇文章小编为大家介绍,关于MySQL的安全问题从安装开始说起,有需要的朋友可以参考一下
当你安装 MySQL 完后、会有个提示:

[root@localhost Desktop]# rpm -ivh MySQL-server-5.5.28-1.rhel5.i386.rpm
Preparing... ########################################### [100%]
1:MySQL-server ########################################### [100%]


PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h localhost.localdomain password 'new-password'


Alternatively you can run:

/usr/bin/mysql_secure_installation

**对于这 2 种方式、我个人认为、mysql_secure_installation 比较好用***

which will also give you the option of removing the test
databases and anonymous user created by default
. This is
strongly recommended for production servers.


**我觉得、这里的关键应该是能够把匿名用户给删掉***
See the manual for more instructions.

Please report any problems with the /usr/bin/mysqlbug script!


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 installationgo a bit smoother.

You should remove them before moving into a production environment

**匿名用户的危害****

所以、生产环境请务必删之!!


我选择 mysql_secure_installation


[root@localhost Desktop]# 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.

You already have a root password set, so you can safely answer 'n'.

Change the root password? [Y/n] n
... skipping.

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

Thanks for using MySQL!

相关文章

  • Unity连接MySQL并读取表格数据的实现代码

    Unity连接MySQL并读取表格数据的实现代码

    本文给大家介绍Unity连接MySQL并读取表格数据的实现代码,实例化的同时调用MySqlConnection,传入参数,这里的传入参数个人认为是CMD里面的直接输入了,string格式直接类似手敲到cmd里面,完整代码参考下本文
    2021-06-06
  • mysql Community Server 5.7.19安装指南(详细)

    mysql Community Server 5.7.19安装指南(详细)

    这篇文章主要介绍了mysql Community Server 5.7.19安装指南(详细),需要的朋友可以参考下
    2017-10-10
  • MySQL 中 DATE / DATETIME / TIMESTAMP 的区别小结

    MySQL 中 DATE / DATETIME / TIME

    在 MySQL 中,DATE、DATETIME、TIMESTAMP 都用来表示时间,但语义、存储方式以及对时区的处理完全不同,本文就来详细的介绍一下这三种的用法,感兴趣的可以了解一下
    2026-02-02
  • Ubuntu上安装MySQL+问题处理+安全优化

    Ubuntu上安装MySQL+问题处理+安全优化

    这篇文章主要汇总介绍了Ubuntu上安装MySQL+问题处理+安全优化的相关事项,非常的细致全面,有需要的小伙伴可以参考下
    2016-03-03
  • mysql如何查找连续出现n次以上的数

    mysql如何查找连续出现n次以上的数

    这篇文章主要介绍了mysql如何查找连续出现n次以上的数,具有很好的参考价值,希望对大家有所帮助。如有错误或未考虑完全的地方,望不吝赐教
    2022-05-05
  • MySQL8.0移除传统的.frm文件原因及解读

    MySQL8.0移除传统的.frm文件原因及解读

    MySQL 8.0移除传统的.frm文件,采用基于InnoDB的事务型数据字典,主要解决了元数据不一致、性能优化、架构简化、增强功能支持、兼容性与升级问题,这一变革提高了数据库的可靠性和性能,为未来的高级功能奠定了基础
    2025-03-03
  • mysql批量执行sql文件的方法

    mysql批量执行sql文件的方法

    下面小编就为大家带来一篇mysql批量执行sql文件的方法。小编觉得挺不错的,现在就分享给大家,也给大家做个参考。一起跟随小编 过来看看吧
    2016-10-10
  • MySQL中配置文件my.cnf因权限问题导致无法启动的解决方法

    MySQL中配置文件my.cnf因权限问题导致无法启动的解决方法

    这篇文章主要给大家介绍了关于MySQL中配置文件my.cnf因权限问题导致无法启动的解决方法,该无法启动的错误提示代码是:World-writable config file '/etc/my.cnf' is ignored,文中给出了详细的解决方法,需要的朋友们下面来一起看看吧。
    2017-06-06
  • MySQL存储过程的权限问题小结

    MySQL存储过程的权限问题小结

    这篇文章主要介绍了MySQL存储过程的权限问题小结及mysql 创建存储过程权限问题,感兴趣的朋友一起看看吧
    2018-04-04
  • 详解MySQL存储过程的创建和调用

    详解MySQL存储过程的创建和调用

    这篇文章主要为大家介绍了MySQL存储过程的创建和调用,具有一定的参考价值,感兴趣的小伙伴们可以参考一下,希望能够给你带来帮助
    2021-12-12

最新评论