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!

相关文章

  • mysql中的int(10)int(20)分别代表什么意思

    mysql中的int(10)int(20)分别代表什么意思

    这篇文章主要介绍了mysql中的int(10)int(20)分别代表什么意思,具有很好的参考价值,希望对大家有所帮助。如有错误或未考虑完全的地方,望不吝赐教
    2023-05-05
  • Mysql树形结构的数据库表设计方案

    Mysql树形结构的数据库表设计方案

    树形结构对大家来说应该都不陌生,在日常开发中经常会遇到,下面这篇文章主要给大家介绍了关于Mysql树形结构的数据库表设计的相关资料,文中通过示例代码的非常详细,需要的朋友可以参考下
    2021-09-09
  • java连接mysql底层封装详解

    java连接mysql底层封装详解

    这篇文章主要介绍了java连接mysql底层封装,文中示例代码介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
    2019-10-10
  • windows下MySQL免安装版配置教程mysql-5.6.51-winx64.zip版本(最新安装教程)

    windows下MySQL免安装版配置教程mysql-5.6.51-winx64.zip版本(最新安装教程)

    这篇文章主要介绍了windows下MySQL免安装版配置教程mysql-5.6.51-winx64.zip版本(最新安装教程),本文通过图文并茂的形式给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下
    2023-01-01
  • Mysql、Oracle中常用的多表修改语句总结

    Mysql、Oracle中常用的多表修改语句总结

    这篇文章主要给大家介绍了关于Mysql、Oracle中常用的多表修改语句的相关资料,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
    2020-12-12
  • 如何恢复MySQL主从数据一致性

    如何恢复MySQL主从数据一致性

    MySQL主从数据一致性怎么恢复,MySQL主从数据库的数据不一致,猜测备库在同步过程中出现了问题,现在的问题很明确,就是如何恢复主从库数据的一致性,下文为大家分享解决方法,感兴趣的小伙伴们可以参考一下
    2016-04-04
  • MySQL一个索引最多有多少个列?真实的测试例子

    MySQL一个索引最多有多少个列?真实的测试例子

    MySQL一个索引最多有多少个列?下面是具体的实现代码。
    2009-07-07
  • MySQL由浅入深探究存储过程

    MySQL由浅入深探究存储过程

    存储过程就是一条或者多条SQL语句的集合,可以视为批文件,它可以定义批量插入的语句,也可以定义一个接收不同条件的SQL,下面这篇文章主要给大家介绍了关于MySQL中存储过程的相关资料,需要的朋友可以参考下
    2022-07-07
  • Centos下 修改mysql密码的方法

    Centos下 修改mysql密码的方法

    这篇文章主要介绍了Centos下 修改mysql密码的方法,需要的朋友可以参考下
    2017-02-02
  • 一文带你了解MySQL之约束

    一文带你了解MySQL之约束

    在SQL标准中,一共规定了6种不同的约束,包括非空约束,唯一约束和检查约束等,而在MySQL中是不支持检查约束的,所以这篇文章先对其余5种约束做一个详解和练习,需要的朋友可以参考下
    2023-06-06

最新评论