编译安装完mysql5.6,如果用于生产环境,最好执行mysql_secure_installation来做一些常规化安全设置。

需要提前将~mysql/bin加入环境变量

/apps/mysql//bin/mysql_secure_installation

------------->

  1. NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
  2.  
  3. SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
  4.  
  5. In order to log into MySQL to secure it, we'll need the current
  6.  
  7. password for the root user. If you've just installed MySQL, and
  8.  
  9. you haven't set the root password yet, the password will be blank,
  10.  
  11. so you should just press enter here.
  12.  
  13. Enter current password for root (enter for none):

提示输入密码,没有密码就直接回车

  1. OK, successfully used password, moving on...
  2.  
  3. Setting the root password ensures that nobody can log into the MySQL
  4.  
  5. root user without the proper authorisation.
  6.  
  7. Set root password? [Y/n]

提示设置root user密码  Y

  1. New password:
  2.  
  3. Re-enter new password:
  4.  
  5. Password updated successfully!
  6.  
  7. Reloading privilege tables..
  8.  
  9. ... Success!
  10.  
  11. By default, a MySQL installation has an anonymous user, allowing anyone
  12.  
  13. to log into MySQL without having to have a user account created for
  14.  
  15. them. This is intended only for testing, and to make the installation
  16.  
  17. go a bit smoother. You should remove them before moving into a
  18.  
  19. production environment.
  20.  
  21. Remove anonymous users? [Y/n]

生产环境建议删除系统创建的匿名用户  Y

  1. ... Success!
  2.  
  3. Normally, root should only be allowed to connect from 'localhost'. This
  4.  
  5. ensures that someone cannot guess at the root password from the network.
  6.  
  7. Disallow root login remotely? [Y/n]

禁止root用户远程登录  Y

  1. By default, MySQL comes with a database named 'test' that anyone can
  2.  
  3. access. This is also intended only for testing, and should be removed
  4.  
  5. before moving into a production environment.
  6.  
  7. Remove test database and access to it? [Y/n]

删除test数据库  Y

  1. - Dropping test database...
  2.  
  3. ... Success!
  4.  
  5. - Removing privileges on test database...
  6.  
  7. ... Success!
  8.  
  9. Reloading the privilege tables will ensure that all changes made so far
  10.  
  11. will take effect immediately.
  12.  
  13. Reload privilege tables now? [Y/n]

重载权限表  Y

  1. ... Success!
  2.  
  3. All done! If you've completed all of the above steps, your MySQL
  4.  
  5. installation should now be secure.
  6.  
  7. Thanks for using MySQL!
  8.  
  9. Cleaning up...

完成~~~

完成后空密码已经无法登录

# mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

mysql> select user,host from mysql.user;
+-------+-----------+
| user | host |
+-------+-----------+
| root | 127.0.0.1 |
| root | ::1 |
| root | localhost |
+-------+-----------+
4 rows in set (0.01 sec)

mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
+--------------------+
3 rows in set (0.00 sec)

mysql_secure_installation 安全安装(用于生产环境设置)的更多相关文章

  1. 基于redis的分布式锁(不适合用于生产环境)

    基于redis的分布式锁 1 介绍 这篇博文讲介绍如何一步步构建一个基于Redis的分布式锁.会从最原始的版本开始,然后根据问题进行调整,最后完成一个较为合理的分布式锁. 本篇文章会将分布式锁的实现分 ...

  2. Python 2/3 安装与运行环境设置

    Python 2/3 安装与运行环境设置: 1.Python 软件源:https://www.python.org/    下载Win版本 https://www.python.org/downloa ...

  3. windows下安装python、环境设置、多python版本的切换、pyserial与多版本python安装、windows命令行下切换目录

    1.windows下安装python 官网下载安装即可 2.安装后的环境设置 我的电脑--属性--高级--设置path的地方添加python安装目录,如C:\Python27;C:\Python33 ...

  4. Windows10内置ubuntu子系统安装后中文环境设置

    原文:Windows10内置ubuntu子系统安装后中文环境设置 第一开启相关设置,使用小娜(Win键+c)直接查找关键字打开更快.   ①设置→查找"针对开发人员"→开发人员模式 ...

  5. (转)centos 7 Tomcat 8.5 的安装及生产环境的搭建调优

    原文:https://www.cnblogs.com/linhankbl/articles/9149804.html#top JVM菜鸟进阶高手之路七(tomcat调优以及tomcat7.8性能对比) ...

  6. 结合Git实现Mysql差异备份,可用于生产环境

    埋头苦干多年一直没写过文章,今天突发狂想,为LNMP阵营贡献一些力量.就从平时工作过程中的心得和一些技巧分享出来.今天就猿们最熟悉的Mysql开始宅鸟的开篇博客文章.欢迎猿们拍砖.转载. 注意:宅鸟的 ...

  7. Ocelot中文文档-Raft(实验功能不能用于生产环境)

    Ocelot最近整合了Rafty,这是我在去年一直研究的Raft的一个实现. 这个项目实验性非常强,所以在我认为它没问题之前,请不要在生产环境中使用Ocelot的这个功能. Raft是一种分布式一致性 ...

  8. redis 编译安装(生产环境推荐)

    一.安装redis 1.下载redis包 wget http://download.redis.io/releases/redis-3.2.1.tar.gz 2.解压redis包到/opt下 tar ...

  9. 8 个用于生产环境的 SQL 查询优化调整

    在没有数据仓库或单独的分析数据库的组织中,报告的唯一来源和最新的数据可能是在现场生产数据库中. 在查询生产数据库时,优化是关键.一个低效的查询可能会对生产数据库产生大量的资源消耗,如果查询有错误会引发 ...

随机推荐

  1. 剑指offer_2.1_Day_5

    输入一个链表,按链表从尾到头的顺序返回一个ArrayList. import java.util.ArrayList; public class Solution { public ArrayList ...

  2. IDEA的一些常用设置

    一.给方法之间添加分割线 效果: 二.自动导包 三.字体以及大小和行间距 四.注释的字体颜色 五.项目编码 六.省点模式(开启省点模式后会取消代码检查和提示等,需要注意) 七.代码垂直或者水平分区显示 ...

  3. 用Maven整合SSM项目实例

     转自https://www.cnblogs.com/hujianblogs/p/8526737.html 本人在学习Maven之余,为了深入了解Maven的用法,决定创建一个SSM整合实例.项目是自 ...

  4. 备份mysql的批处理命令

    需要工具mysqldump.exe的支持,安装mysql默认是带此工具的 批处理命令 set NOW_TIME_HH=%time:~0,2% if "%NOW_TIME_HH%" ...

  5. IE8Get请求中文不兼容:encodeURI的使用

    IE8Get请求中文不兼容:encodeURI的使用 在开发过程中遇到在IE8下,请求出错. 后发现Get请求中含有中文字符. 使用js自带的encodeURI函数对中文进行编码,问题解决. enco ...

  6. 在VS中编写Qt5涉及到的一点字符串问题

    在VS中开发Qt5程序似乎成了我的一种习惯,因为觉得VS简直不能再溜了,不愧是"宇宙第一IDE". 所以在开发中难免会遇到中文显示乱码的问题,网上找到的很多方法都是类似于下面这样的 ...

  7. VC++ DLL 1 一点概念

    1.在写代码的时候,我们可能会经常要用到一些封装好的函数或者类,这些可能是C/C++的标准库提供的,也可能是由别人开发的非标准库,这个时候就会涉及到动态链接库或者静态链接库的使用了. 举个例子,做图像 ...

  8. 循环(while,break,continue),转义字符

    01. 程序的三大流程 在程序开发中,一共有三种流程方式: 顺序 -- 从上向下,顺序执行代码 分支 -- 根据条件判断,决定执行代码的 分支 循环 -- 让 特定代码 重复 执行 02. while ...

  9. iOS 中的延时操作方法

    1. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_q ...

  10. SQL基础教程(第2版)第3章 聚合与排序:3-4 对查询结果进行排序

    第3章 聚合与排序:3-4 对查询结果进行排序 ● 使用ORDER BY子句对查询结果进行排序.● 在ORDER BY子句中列名的后面使用关键字ASC可以(通常省略默认)进行升序排序,使用DESC关键 ...