mysql_secure_installation

阅读数:53 评论数:0

跳转到新版页面

分类

数据库

正文

一、概述

安装完mysql-server会提示可以运行mysql_secure_installation,它会执行几个设置:

1、为root用户设置密码

2、删除匿名账号

3、取消root用户远程登录

4、删除test库和对test库的访问权限

5、刷新权限表,并使修改生效。

通过 这几项的设置 能够提高 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!



相关推荐

Centos7的yum源中没有mysql,为了解决这个问题,我们需要先下载mysql的repo源。 一、下载mysql的repo源并安装 wget http://repo.mysql.com/mysq

备份的类型 1、根据是否需要数据库离线 (1)冷备: 需要关mysql服务,请写请求均不允许 (2)温备: 服务在线,但仅支持读请求。 <p

如果主库已经投入使用了,此时如果需要主从同步,需要导出所表结构和数据,然后导入到从库中。这时需要注意修改/var/lib/mysql/auto.cnf中uuid。 master配

一、事务的ACID 1、Atomicity原子性 Transactions are often composed of multiple statements. Atomicity guarantee

一、登录mysql mysql --version -查看Mysql版本 mysql -h hostname -u username -p -h:运行mysql服务器的机器,如果正在该机器上运行此命令

mysql的权限分为4级:全局、数据库、表、列。 1、grant grant privileges [

insert [into] table [(column1,column2,column3,...)] values (val

一、语法 select [optioins] items [into file_details] from tables [where conditions] [group by gr

一、语法 update [low_priority] [ignore] tablename set column1=expression1,... [where condition] [order b

一、语法 1、基本语法 alter table [ignore] tablename alteration [,alteration...] (1)ignore,如果会导致唯一键重复,则这些操作将自动