Home Database Mysql Tutorial 实验理解ADMINOPTION和GRANTOPTION的用法

实验理解ADMINOPTION和GRANTOPTION的用法

Jun 07, 2016 pm 04:10 PM
experiment understand

使用GRANT赋予用户权限的时候通常有ADMIN OPTION和GRANT OPTION这两个OPTION。下面使用简单的实验来体会下这两种授权的用途。 一、ADMIN OPTION参数 实验: 1. 创建测试用户user_a和user_b : 2. 默认情况下,user_ vc3Ryb25nPjxzdHJvbmc+YbrNdXNlcl9iysfDu9

使用GRANT赋予用户权限的时候通常有ADMIN OPTION和GRANT OPTION这两个OPTION。下面使用简单的实验来体会下这两种授权的用途。

一、ADMIN OPTION参数

实验:

1. 创建测试用户user_a和user_b

\

2. 默认情况下,user_喎?http://www.2cto.com/kf/ware/vc/" target="_blank" class="keylink">vc3Ryb25nPjxzdHJvbmc+YbrNdXNlcl9iysfDu9PQvaix7cioz948L3N0cm9uZz6jujxicj4KPC9wPgo8cD48aW1nIHNyYz0="http://www.2cto.com/uploadfile/Collfiles/20141125/2014112509180832.png" alt="\">

3. SYS账户GRANT CREATE TABLE权限给user_a,但user_a则是没有权限授予user_b建表权限

\

4. SYS账户GRANT CREATE TABLE权限给user_a,同时带上WITH ADMIN OPTION,此时user_a可以授予user_b建表权限

\

5. SYS账户收回user_a的CREATE TABLE权限

\

6. 此时user_b仍可具有CREATE TABLE权限,尽管这里报错

\

注:这个错是说user_b没有默认表空间USERS的使用权限,并不是没有建表权限,此时需要SYS账户使用GRANT UNLIMITED TABLESPACE TO user_b或ALTER USER user_b quota 100m on USERS让user_b用户可以使用USERS表空间

\

总结

1. 带有WITH ADMIN OPTION的权限授予方式,可传递授权。

2. 带有WITH ADMIN OPTION的权限授予方式,当使用REVOKE收回权限时,传递的授权并不会自动收回。

3. ADMIN OPTION用于系统权限,system privilege,例如CREATE TABLE。

二、GRANT OPTION

实验:

1. 授予user_a和user_b创建session的权限,但用user_a查询dcsopen的t1表时提示无此权限

\

2. SYS账户使用WITH GRANT OPTION授予user_a查询dcsopen.t1表权限

\

此时user_a可以查询表:

\

3. 使用user_a授予user_b查询dcsopen.t1表权限

\

4. SYS账户收回user_a的查询dcsopen.t1表的权限

\

5. 使用user_b用户查询dcsopen.t1表时提示无权限

总结

1. 使用WITH GRANT OPTION的权限授予方式,可传递授权。

2. 使用WITH GRANT OPTION的权限授予方式,当使用REVOKE收回权限时,传递的授权会自动收回。

3. GRANT OPTION用于对象权限,object privilege,例如SELECT ON TABLE。

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Two Point Museum: All Exhibits And Where To Find Them
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Will human trials be scrapped? Musk's Neuralink faces federal investigation, experimental animals die frequently Will human trials be scrapped? Musk's Neuralink faces federal investigation, experimental animals die frequently Apr 12, 2023 pm 05:37 PM

Last week, Musk held Neuralink’s Show & Tell demonstration event to show the world the latest progress in brain-computer interfaces. At the meeting, Musk said that it is very difficult to go from prototype to production and faces many challenges. Neuralink has been working hard to initiate human trials and has submitted all the necessary documentation to the FDA to begin human trials. Musk estimates that the first Neuralink device could be in the human brain within 5-6 months. At the meeting, Musk emphasized that Neuralink respects animal subjects and that brain-computer interface devices have undergone extensive benchmark testing before being implanted in animals. Two monkeys Pager and

How to correctly understand value passing in PHP How to correctly understand value passing in PHP Mar 08, 2024 pm 03:30 PM

How to correctly understand the value passing method in PHP PHP is a scripting language widely used in Web development, and the parameter passing methods in PHP mainly include value passing and reference passing. And understanding how values ​​are passed in PHP is crucial to writing efficient code. This article will discuss the value passing method in PHP in detail and use specific code examples to help readers better understand. The basic concept of value passing method is to copy the value of a variable and pass it to a function or method. Operations on the value within the function will not affect it.

In-depth understanding of how to use Linux pipelines In-depth understanding of how to use Linux pipelines Feb 21, 2024 am 09:57 AM

In-depth understanding of the use of Linux pipes In the Linux operating system, pipes are a very useful function that can use the output of one command as the input of another command, thereby conveniently realizing various complex data processing and operations. A deep understanding of how Linux pipes are used is very important for system administrators and developers. This article will introduce the basic concepts of pipelines and show how to use Linux pipelines for data processing and operations through specific code examples. 1. Basic concepts of pipes in Linux

In-depth understanding of the strings.Split function in Go language documentation In-depth understanding of the strings.Split function in Go language documentation Nov 04, 2023 pm 01:14 PM

To deeply understand the strings.Split function in the Go language documentation, specific code examples are required. In the Go language, string operations are a very common requirement. Among them, the strings package is a standard package provided by the Go language and provides a wealth of string processing functions. Among them, the strings.Split function is one of the commonly used functions. Its function is to split a string into a string slice according to the specified delimiter. Before we officially dive into the strings.Split function,

Understand the importance of Go language comments Understand the importance of Go language comments Mar 29, 2024 pm 04:48 PM

Comments are a very important part of Go programming. Comments can help programmers better understand the logic, purpose, and details of the code, thereby improving the readability and maintainability of the code. This article will introduce the importance of comments in the Go language, and combine it with specific code examples to illustrate how comments help code understanding. First, let's look at a simple Go program example: packagemainimport "fmt" funcmain(){/

In-depth understanding of Boolean types in MySQL In-depth understanding of Boolean types in MySQL Mar 15, 2024 pm 05:30 PM

The Boolean type in MySQL is a very practical data type. It is used to store logical values ​​and can only take two values: TRUE or FALSE. In MySQL, the Boolean type is also called BOOL or BOOLEAN and can be represented by TINYINT(1). In this article, we will delve into the definition, usage, and specific code examples of the Boolean type in MySQL. First, let's take a look at how to define a Boolean column in MySQL: CREATETABLEus

Explain in simple terms: Thoroughly understand the working principle of Go language range Explain in simple terms: Thoroughly understand the working principle of Go language range Mar 12, 2024 pm 02:18 PM

Go language is a concise and powerful programming language with unique design and features in many aspects. One of the most impressive features is the range keyword, which is used to iterate over data structures such as arrays, slices, maps, and channels. The flexibility and convenience of range make it easy to traverse complex data structures, but many people are confused about how it works. This article will explain how range works in a simple and in-depth way, and use specific code examples to help readers better understand. First, let's look at a simple example

Understanding the middleware of ThinkPHP6 Understanding the middleware of ThinkPHP6 Jun 20, 2023 am 10:03 AM

As the complexity of modern web applications continues to increase, code logic is becoming more and more complex. To solve this problem, middleware is becoming more and more popular in modern web development. ThinkPHP6 is a popular PHP framework that also supports middleware. In this article, we will discuss the basics and practical uses of ThinkPHP6 middleware. What is middleware? In web development, middleware refers to a way of processing HTTP requests and responses. When the client sends a request to the server,

See all articles