mysql服务器初始设置_安全初始化MySql服务器

本文介绍了如何使用mysql_secure_installation命令对MySQL服务器进行安全初始化,包括设置root用户密码、删除匿名用户、禁止远程root登录以及移除测试数据库等步骤,确保服务器在生产环境中更加安全。
摘要由CSDN通过智能技术生成

我们在安装完MySql服务器,设置好MySql的root用户密码后,就直接开始使用了,其实这样的MySql服务器还存在着一些不安全因素,

本篇演示一下用命令mysql_secure_installation来安全初始化我们的MySql服务器。

01 [root@test ~]# /usr/bin/mysql_secure_installation

02 NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL

03       SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

04

05 In order to log into MySQL to secure it, we'll need the current

06 password for the root user.  If you've just installed MySQL, and

07 you haven't set the root password yet, the password will be blank,

08 so you should just press enter here.

09

10 Enter current password for root (enter for none):

11 OK, successfully used password, moving on...

12

13 Setting the root password ensures that nobody can log into the MySQL

14 root user without the proper authorisation.

15

16 Set root password? [Y/n] Y  

17 New password:

18 Re-enter new password:

19 Password updated successfully!

20 Reloading privilege tables..

21  ... Success!

22

23 By default, a MySQL installation has an anonymous user, allowing anyone

24 to log into MySQL without having to have a user account created for

25 them.  This is intended only for testing, and to make the installation

26 go a bit smoother.  You should remove them before moving into a

27 production environment.

28

29 Remove anonymous users? [Y/n] Y

30  ... Success!

31

32 Normally, root should only be allowed to connect from 'localhost'.  This

33 ensures that someone cannot guess at the root password from the network.

34

35 Disallow root login remotely? [Y/n] Y

36  ... Success!

37

38 By default, MySQL comes with a database named 'test' that anyone can

39 access.  This is also intended only for testing, and should be removed

40 before moving into a production environment.

41

42 Remove test database and access to it? [Y/n]

43  - Dropping test database...

44  ... Success!

45  - Removing privileges on test database...

46  ... Success!

47

48 Reloading the privilege tables will ensure that all changes made so far

49 will take effect immediately.

50

51 Reload privilege tables now? [Y/n] Y

52  ... Success!

53

54 Cleaning up...

55

56 All done!  If you've completed all of the above steps, your MySQL

57 installation should now be secure.

58

59 Thanks for using MySQL!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值