mysql5.6
grant all privileges on *.* to root@'%' identified by "mysql_pwd" with grant option;
grant all privileges on *.* to root@'localhost' identified by "mysql_pwd" with grant option;
grant all privileges on *.* to root@'127.0.0.1' identified by "mysql_pwd" with grant option;
drop database if exists test;
use mysql;
delete from user where not (user='root');
delete from db where user='';
UPDATE user SET password=PASSWORD('mysql_pwd') WHERE user='root' AND host='127.0.0.1' OR host='%' OR host='localhost';
delete from user where password='';
flush privileges;
select user,password,host from mysql.user;
exit;

mysql5.7:
grant all privileges on *.* to root@'%' identified by "mysql_pwd" with grant option;
grant all privileges on *.* to root@'localhost' identified by "mysql_pwd" with grant option;
grant all privileges on *.* to root@'127.0.0.1' identified by "mysql_pwd" with grant option;
drop database if exists test;
use mysql;
delete from user where not (user='root');
delete from db where user='';
delete from user where authentication_string='';
update mysql.user set authentication_string=password('mysql_pwd') where user='root' AND host='127.0.0.1' OR host='%' OR host='localhost';
flush privileges;
select user,authentication_string,host from mysql.user;
exit;

mysql5.6和5.7的权限密码设置的更多相关文章

  1. (转)mysql账号权限密码设置方法

    原文:http://www.greensoftcode.net/techntxt/2013410134247568042483 mysql账号权限密码设置方法 我的mysql安装在c:\mysql 一 ...

  2. redis密码设置、访问权限控制等安全设置

    redis作为一个高速数据库,在互联网上,必须有对应的安全机制来进行保护,方法有2,如下. 1.比较安全的办法是采用绑定IP的方式来进行控制.  请在redis.conf文件找到如下配置 # If y ...

  3. Mysql用户密码设置修改和权限分配

    我的mysql安装在c:\mysql 一.更改密码 第一种方式: 1.更改之前root没有密码的情况 c:\mysql\bin>mysqladmin -u root password " ...

  4. 修改本地数据库root权限密码

    方法1: 用SET PASSWORD命令 测试成功 首先登录MySQL @1——mysql DOS 窗口中. 格式:mysql> set password for 用户名@localhost = ...

  5. Centos7.3下mysql5.7.18安装并修改初始密码的方法

    Centos7.3下mysql5.7.18安装并修改初始密码的方法 原文链接:http://www.jb51.net/article/116032.htm 作者:Javen205 字体:[增加 减小] ...

  6. ubuntn中root密码设置和权限给予

    个人理解: 1.安装ubuntn,会首先要求有一个账号密码设置,比如我设置的:用户名irt,密码**,这是一个普通账户,此时,超级管理账户root密码是空的: 2.给root账户设置密码,大概步骤见下 ...

  7. mysql5.7密码设置

    mysql5.7版本引入了强制更改密码的举措,只能吐槽一句,shit!mysql5.7安装安装完mysql之后,mysql已经随机指定了一个初始化密码,可以在mysql的错误日志中找到初始化密码: c ...

  8. day 7-11 初识MySQL数据库及安装密码设置破解

    一. 什么是数据库 之前所学,数据要永久保存,比如用户注册的用户信息,都是保存于文件中,而文件只能存在于某一台机器上. 如果我们不考虑从文件中读取数据的效率问题,并且假设我们的程序所有的组件都运行在一 ...

  9. {MySQL数据库初识}一 数据库概述 二 MySQL介绍 三 MySQL的下载安装、简单应用及目录介绍 四 root用户密码设置及忘记密码的解决方案 五 修改字符集编码 六 初识sql语句

    MySQL数据库初识 MySQL数据库 本节目录 一 数据库概述 二 MySQL介绍 三 MySQL的下载安装.简单应用及目录介绍 四 root用户密码设置及忘记密码的解决方案 五 修改字符集编码 六 ...

随机推荐

  1. eclipse创建文件携带作者时间

    windows–>preference Java–>Code Style–>Code Templates code–>new Java files 编辑它 ${filecomm ...

  2. CI_CD(jenkins)公司实战_未完成版

    环境准备 #三台服务器,不同的ip centos   镜像时:CentOS Linux release 7.6.1810 (Core) gitlab-ce 版本是:11.11.3 jenkins   ...

  3. shell_切割日志

    可以修改的:1.日志存放目录:logdir='/data/logs/'2.每个类型日志保留个数:savefiles=30 #!/bin/bashnum=$(date -d"+1 day ag ...

  4. VMware-workstation虚拟机安装及配置

    目录 安装准备 开始安装 设置虚拟机文件默认位置 安装准备 系统环境:Windows10 专业版 软件:VMware-workstation-full-14.0.0.24051.exe 秘钥:FF31 ...

  5. mysql绿色版小白简易安装教程

    第一步,解压并安装mysql 我们先解压整个安装包 然后进入解压后的安装包 复制安装包路径 然后按Windows键,打开"开始",输入cmd 接着以管理员方式打开cmd 如图 接着 ...

  6. 37)PHP,获取数据库数据并在html中显示(晋级4)

    我的php文件和html文件的位置关系: 然后我的主php文件是b.php,我的那个配置文件是BBB.php,我的html文件是login.html 然后我的b.php代码展示: <?php c ...

  7. kubernets轻量 contain log 日志收集技巧

    首先这里要收集的日志是容器的日志,而不是集群状态的日志 要完成的三个点,收集,监控,报警,收集是基础,监控和报警可以基于收集的日志来作,这篇主要实现收集 不想看字的可以直接看代码,一共没几行,尽量用调 ...

  8. ElasticSearch6 报错blocked by: [FORBIDDEN/12/index read-only / allow delete (api)];

    原文连接:https://blog.csdn.net/u013042707/article/details/84110531 方案:curl -XPUT -H "Content-Type: ...

  9. built?

    题目描述 There are N towns on a plane. The i-th town is located at the coordinates (xi,yi). There may be ...

  10. nginx.conf文件详解

    https://www.jb51.net/article/103968.htm https://www.cnblogs.com/zhang-shijie/p/5428640.html https:// ...