[SQL] 简单新建(create)删除(drop\delete)权限(grant/revoke)修改(set\update)
一、前言
说起来 数据库(Structured Query Language),本站写过很多类似文章。
如:
甚至:我还做了一个项目:SQL 中用户建立与权限授予
然而,今天弄信息安全的时候一个 MYSQL 的问题瞬间把握弄懵了。我就在想如果碰到 利用社区开源代码进行二次开发的商业软件,那应该怎么办呢?有哪些具体的操作。

本文针对上述内容做了思考,总结以下内容。
二、思考
从商业软件的角度出发,一定是希望以最小的代价获取最大的回报。
- 利用 mairadb 开源代码完成核心部分,开发一个 GUI 外壳方便用户使用与隐藏伪装。
- 利用 phpmyadmin 现成网页端解决方案。
- MySQL 生态非常好,兼容性非常高。
三、检查
1、确定 my.ini 位置
首先找到 control panel -> 看到MYSQL服务 -> 右键属性确定my.ini位置

2、尝试登陆

发现无法登陆。(using password: YES)
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password)
这种类型的提示是帐号密码不对或者帐号不存在的现象。
四、破解

1、添加 skip-grant-tables

在文件“底部”添加 skip-grant-tables 保存退出 -> 重启服务
BTW:网上说给 mysqld.exe 加 --skip-grant-tables 进行权限的略过,我并没有成功。
2、破解登陆
2-1、查询情况
cmd.exe -> mysql -h localhost -u root -p > 直接登陆
MariaDB [(none)]> select user,host from mysql.user;
+------+-----------+
| user | host |
+------+-----------+
| root | 127.0.0.1 |
| root | ::1 |
| root | localhost |
+------+-----------+
3 rows in set (0.00 sec)
MariaDB [(none)]>
2-2、新建用户
MariaDB [(none)]> create user 'root'@'%' identified by "example";
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.01 sec)
MariaDB [(none)]>
2-3、删除用户
MariaDB [(none)]> drop user 'root'@'%';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]>
这样就没办法远程登陆(“%”)了
2-4、权限相关
MariaDB [(none)]> grant all privileges on *.* to 'rabbit'@'%' IDENTIFIED BY 'rabbit';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> revoke all privileges on *.* from 'root'@'%' ;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]>
- ALL PRIVILEGES- as we saw previously, this would allow a MySQL user all access to a designated database (or if no database is selected, across the system)
- CREATE- allows them to create new tables or databases
- DROP- allows them to them to delete tables or databases
- DELETE- allows them to delete rows from tables
- INSERT- allows them to insert rows into tables
- SELECT- allows them to use the Select command to read through databases
- UPDATE- allow them to update table rows
- GRANT OPTION- allows them to grant or remove other users' privileges
2-5、修改密码
MariaDB [(none)]> SET PASSWORD FOR 'rabbit'@'%' = PASSWORD('test');
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> UPDATE mysql.user SET password=PASSWORD('other-way') where user = 'rabbit' and host = '%';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
希望大家都能熟练掌握。
[SQL] 简单新建(create)删除(drop\delete)权限(grant/revoke)修改(set\update)的更多相关文章
- SQL 触发器 新建时删除相同数据
--create alter trigger [dbo].[trigger_sqsj] on [dbo].[lctnrcrd] after INSERT as BEGIN ) id ),dlr,) d ...
- MySQL行(记录)的详细操作一 介绍 二 插入数据INSERT 三 更新数据UPDATE 四 删除数据DELETE 五 查询数据SELECT 六 权限管理
MySQL行(记录)的详细操作 阅读目录 一 介绍 二 插入数据INSERT 三 更新数据UPDATE 四 删除数据DELETE 五 查询数据SELECT 六 权限管理 一 介绍 MySQL数据操作: ...
- oracle 中删除表 drop delete truncate
oracle 中删除表 drop delete truncate 相同点,使用drop delete truncate 都会删除表中的内容 drop table 表名 delete from 表名 ...
- SQL基础教程(第2版)第4章 数据更新:4-2 数据的删除(DELETE)
第4章 数据更新:4-2 数据的删除(DELETE) ● 如果想将整个表全部删除,可以使用DROP TABLE语句,如果只想删除表中全部数据,需使用DELETE语句.● 如果想删除部分数据行,只需在W ...
- 数据库的SQL基本用法 创建 删除 查询 修改
1.说明:创建数据库CREATE DATABASE database-name 2.说明:删除数据库drop database dbname 3.说明:备份sql server--- 创建 备份数据的 ...
- mysql用户密码修改,用户添加、删除及设置权限
一下的示例所用用户名和密码为:test,111111 Mysql密码修改: Mysql修改密码需要root的权限,先执行mysql -uroot -p(密码); 1)使用set password方式来 ...
- Sql Server来龙去脉系列 必须知道的权限控制核心篇
最近写了<Sql Server来龙去脉系列 必须知道的权限控制基础篇>,感觉反响比较大.这可能也说明了很多程序猿对数据库权限控制方面比较感兴趣,或者某些技术点了解的没有很透彻. 有些人看 ...
- 数据定义: CREATE、DROP、ALTER
CREATE DATABASE 句法 CREATE DATABASE [IF NOT EXISTS] db_name 数据库.表.索引.列和别名 中被给出. 如果数据库已经存在,并且你没有指定 IF ...
- 在SQL Server中快速删除重复记录
在SQL Server中快速删除重复记录 2006-07-17 21:53:15 分类: SQL Server 开发人员的噩梦——删除重复记录 想必每一位开发人员都有过类似的经历,在对数据库进行查询 ...
随机推荐
- [/usr/local/openssl//.openssl/include/openssl/ssl.h] Error 127
/bin/sh: line 2: ./config: No such file or directorymake[1]: *** [/usr/local/ssl/.openssl/include/op ...
- 2015年传智播客JavaEE 第168期就业班视频教程03-ERP简介(2)
资源管理这块的东西大家基本上能够猜个差不多了.下面描述描述计划.计划这个东西把企业资源这个东西提升了不只十倍二十倍了.ERP的核心是计划,但是这次我们做是不做计划的.今年我们是一个生产型企业,我们要开 ...
- sqlserver datetime的bug?
sqlserver datetime 的毫秒的个位似乎存在bug,只有0.3.7这三个值,比如: 2018-01-20 23:59:59:999会变成2018-01-21 00:00:00.000 2 ...
- 滑动窗口的中位数 · Sliding Window Median
[抄题]: 给定一个包含 n 个整数的数组,和一个大小为 k 的滑动窗口,从左到右在数组中滑动这个窗口,找到数组中每个窗口内的中位数.(如果数组个数是偶数,则在该窗口排序数字后,返回第 N/2 个数字 ...
- 洛谷 P2899 [USACO08JAN]手机网络Cell Phone Network(树形动规)
题目描述 Farmer John has decided to give each of his cows a cell phone in hopes to encourage their socia ...
- python 命令行工具 fire
简介 A library for automatically generating command line interfaces. Python Fire is a library for auto ...
- 高性能mysql第三版(文摘)
第1章 mysql架构与历史 1.1处理和存储相分离,用户可以选择合适的存储引擎 1.2并发控制 表锁:开销小 行级锁:开销大 1.3事务 acid特性:原子性,一致性,隔离性,持久性 1.4 多版本 ...
- windows平台使用spark-submit以client方式提交spark应用到standalone集群
1.spark应用打包,我喜欢打带依赖的,这样省事. 2.使用spark-submit.bat 提交应用,代码如下: for /f "tokens=1,2 delims==" %% ...
- CodeForces 518A Vitaly and Strings (水题,字符串)
题意:给定两个相同长度的字符串,让你找出一个字符串,字典序在两都之间. 析:这个题当时WA了好多次,后来才发现是这么水,我们只要把 s 串加上,然后和算数一样,该进位进位,然后再和 t 比较就行. 代 ...
- 组队作业_One
Part 1.前言 结对项目作业 结对同学高裕翔的博客 本博文pdf版本 Part 2.PSP表 PSP3.1 Personal Software Process Stages 预估耗时(分钟) 实际 ...