服务器之家:专注于服务器技术及软件下载分享
分类导航

Mysql|Sql Server|Oracle|Redis|

服务器之家 - 数据库 - Mysql - MySQL的安全问题从安装开始说起

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

2019-12-21 16:37MYSQL教程网 Mysql

本篇文章小编为大家介绍,关于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!

延伸 · 阅读

精彩推荐
  • MysqlMySQL里实现类似SPLIT的分割字符串的函数

    MySQL里实现类似SPLIT的分割字符串的函数

    SQL对字符串的处理能力比较弱,比如我要循环遍历象1,2,3,4,5这样的字符串,如果用数组的话,遍历很简单,但是T-SQL不支持数组,所以处理下来比较麻烦 ...

    MYSQL教程网3282019-12-07
  • Mysqlgetdata table表格数据join mysql方法

    getdata table表格数据join mysql方法

    今天小编就为大家分享一篇关于getdata table表格数据join mysql方法,小编觉得内容挺不错的,现在分享给大家,具有很好的参考价值,需要的朋友一起跟随小...

    我是高手高手高高手2042019-06-04
  • MysqlMySQL数据库存储引擎和分支现状分析

    MySQL数据库存储引擎和分支现状分析

    在MySQL经历了2008年Sun的收购和2009年Oracle收购Sun的过程中,基本处于停滞发展的情况,在可以预见的未来,MySQL是肯定会被Oracle搁置并且逐步雪藏消灭掉的。...

    mysql教程网3062019-11-15
  • MysqlMySQL 密码设置

    MySQL 密码设置

    本文介绍了如何修改一个用户的密码,你可以使用三种方法,GRANT语句、SET PASSWORD语句、直接修改授权表以及使用管理工具mysqladmin。 ...

    mysql教程网1572019-10-26
  • Mysqlnavicat 8 创建数据库与创建用户分配权限图文方法

    navicat 8 创建数据库与创建用户分配权限图文方法

    navicat是一款不错的图形化管理mysql的工具,大家一般都是用phpmyadmin或直接命令行操作,对于不是很熟悉命令的朋友,就可以使用navicat这个工具了,方便操...

    mysql教程网1402019-11-16
  • Mysql超越MySQL 对流行数据库进行分支的知识小结

    超越MySQL 对流行数据库进行分支的知识小结

    尽管MySQL是最受欢迎的程序之一,但是许多开发人员认为有必要将其拆分成其他项目,并且每个分支项目都有自己的专长。该需求,以及 Oracle 对核心产品增...

    MYSQL教程网1682019-11-28
  • Mysqlphp 读取mysql数据库三种方法

    php 读取mysql数据库三种方法

    mysql 读取数据库三种方法,需要的朋友可以参考下。 ...

    mysql教程网2932019-11-04
  • Mysqlmysql 让一个存储过程定时作业的代码

    mysql 让一个存储过程定时作业的代码

    以下例子主要是实现简单的mysq 定时作业,需要的朋友可以参考下。 ...

    mysql教程网2672019-11-19