当前位置: 首页 > news >正文

[Mysql数据库] 用户管理选择题

1.To determine which accounts can be used without specifying a password, use the following statement:确定哪些账号能在不指定密码的情况下使用,用以下的语句

SELECT Host, User FROM mysql.user WHERE Password = '';

a. True

b.False  MySQL 的mysql.user表中不包含Password列。该表包含一个authentication_string列,该列会为部分(但并非全部)身份认证插件存储加密后的密码。

2.Consider the following privilege settings for the accounts associated with a given MySQL username, where the Select_priv column indicates the setting for the global SELECT privilege: 考虑与某个给定 MySQL 用户名关联的账户的以下权限设置,其中Select_priv列表示全局SELECT权限的设置

 mysql> SELECT Host, User, Select_priv FROM mysql.user

 -> WHERE User = 'Sasha';

 +--------------+-------+-------------+

 | Host | User | Select_priv |

 +--------------+-------+-------------+

 | 62.220.12.66 | Sasha | N |

 | 62.220.12.% | Sasha | Y |

 | 62.220.% | Sasha | N |

 +--------------+-------+-------------+

 Note: The Select_priv column indicates that the SELECT privilege for the second entry has been granted on a global scope (*.*). Assume that the Sasha accounts are not granted privileges in any of the other grant tables. 说明:Select_priv列表明第二条记录的SELECT权限已在全局范围(*.*)被授予。假设 Sasha 的账户未在其他任何授权表中被授予权限。

 Can user Sasha select data from any table on the MySQL server when connecting from the following hosts? 当连接以下哪个主机时,用户 Sasha 从能从 MySQL 服务器上的任何表中查询数据?

a. 62.220.12.66  与第一个完全匹配,没有SELECT权限,不能查询任何表。

b. 62.220.12.43  匹配第二个有SELECT权限,可以查询任何表中数据。

c. 62.220.42.43  匹配第三个,没有SELECT权限,不能查询任何表

d. localhost  权限表中没有Host = 'localhost'的记录,即Sasha 无法从本地主机连接到服务器。

3. Which of the following user manipulation statements is true? 以下哪一个用户操作语句是正确的?

a. You can grant additional privileges to an existing user with either an ALTER USER or a GRANT statement. 可以通过ALTER USER或GRANT语句向现有用户授予额外权限。,GRANT语句的核心功能是授予权限,但ALTER USER语句用于修改用户的属性(如密码、过期时间等),不能用于授予权限

b. You can remove a user with either a DROP USER or a REVOKE statement. 可以通过DROP USER或REVOKE语句移除用户。,DROP USER用于删除用户账户,正确,但REVOKE仅用于撤销用户已有的权限,不会删除用户账户本身。

c. You can set a password in both a CREATE USER and an ALTER USER statements 你可以在CREATE USER和ALTER USER语句中设置密码。正确,CREATE USER语句创建用户时,可通过IDENTIFIED BY指定密码(例如:CREATE USER 'user'@'host' IDENTIFIED BY 'password';),正确。ALTER USER语句可修改现有用户的密码(例如:ALTER USER 'user'@'host' IDENTIFIED BY 'new_password';),正确。

4. Assume that a new user has been created, but that user account has not been granted any privileges yet. What can that user do at this point? 假设已创建一个新用户,但该用户账户尚未被授予任何权限。此时该用户能执行什么操作?

a. Connect to the server  连接到服务器。正确,新用户在创建时,只要提供了正确的用户名、主机和密码(或配置了无密码登录),即可通过客户端工具(如mysql命令行)连接到 MySQL 服务器。

b. Browse all table data with statements such as SELECT  使用SELECT等语句浏览所有表数据。,查看表数据需要SELECT权限,而未授权用户没有全局、库级或表级的SELECT权限。

c. Browse all databases with statements such as SHOW DATABASES  使用SHOW DATABASES等语句浏览所有数据库。,SHOW DATABASES命令的执行需要show databases权限(全局权限的一种)。未授权用户默认没有此权限。

5. Which of the following statements about the effects of privilege changes for existing connections are true? 以下关于现有连接的权限变更效果的表述中,哪一项是正确的?

a. When a user is dropped, connections to the server by that user are terminated

automatically.当一个用户被删除时,该用户于服务器的连接将自动停止。,当使用DROP USER删除用户时,已建立的现有连接不会被自动终止。直到连接断开(如主动退出、超时等)。下次尝试连接时,才会因账户不存在而失败。

b. Global privilege changes do not affect existing connections of a user. They take

effect only the next time the user attempts to connect.  全局权限变更不会影响用户的现有连接。它们仅在用户下次尝试连接时生效。,全局权限(如*.*范围的权限)的变更不会影响现有连接。新权限仅在用户下次重新连接后生效。若需强制现有连接生效,需执行FLUSH PRIVILEGES;刷新权限缓存。

c. Database privilege changes take effect only at the time that a user next attempts to

connect.  数据库级权限变更仅在用户下次尝试连接时生效。,数据库级权限(如db.*范围的权限)变更不需要用户重新连接,执行USE <database>语句即可生效。

d. Database privilege changes take effect only at the time that a user next issues a USE

<database> statement.  数据库级权限变更仅在用户下次执行USE <database>语句时生效。,USE <database>是触发数据库权限检查的操作

e. Table and column privileges take immediate effect.  表和列级权限会立即生效。

6. A user wants to activate all the granted roles in the current session. Which of the following statements the user must run? 一个用户想要在当前会话中激活所有已授予的角色。用户必须运行以下哪条语句?

a. SET DEFAULT ROLE ALL  用户登录时自动激活的角色,为用户设置默认角色

b. SET ROLE ALL  在当前会话中立即激活所有已授予该用户的角色

c. SET ROLE DEFAULT  在当前会话中激活用户的默认角色

d. SET activate_all_roles_on_login = ON;  修改系统变量,使用户未来登录时自动激活所有已授予的角色

7. You can grant a user account to another user account. For example: 你可以将一个用户账户授予另一个用户账户。例如:

 GRANT user1 TO user2;

a. True  GRANT语句允许用户将角色授予其他用户账户。

b. False

http://www.xdnf.cn/news/1334431.html

相关文章:

  • ssl代理
  • 面试记录5 .net
  • MySQL 8.x的性能优化文档整理
  • 深入理解与应用向量嵌入(Vector Embeddings):原理、实现与多场景实践
  • linux 内核 - 内存管理单元(MMU)与地址翻译(一)
  • 【GPT入门】第49课 LlamaFacotory 训练千问
  • macos 多个版本的jdk
  • 从ioutil到os:Golang在线客服聊天系统文件读取的迁移实践
  • Linux 文件系统权限管理(补充)
  • 技术半衰期悖论:AI时代“不可替代领域“的深耕地图
  • 【Day 30】Linux-SQL语句
  • 23种设计模式——模板方法模式(Template Method Pattern)详解
  • JavaScript 性能优化实战:从原理到落地的完整指南
  • 深入解析RAGFlow六阶段架构
  • element table 表格多选框选中高亮
  • 实现自己的AI视频监控系统-第一章-视频拉流与解码2
  • 【网络运维】Linux 文本处理利器:sed 命令
  • Obsidian 1.9.10升级
  • Lecture 6 Kernels, Triton 课程笔记
  • python-使用鼠标对图片进行涂抹自定义绘图
  • React框架超详细入门到实战项目演练【前端】【React】
  • 玳瑁的嵌入式日记D21-08020(数据结构)
  • 河南萌新联赛2025第六场 - 郑州大学
  • 一种数字相机中的自动曝光算法
  • Java 性能优化实战(二):JVM 调优的 5 个核心维度
  • ABAP OOP革命:ALV报表面向对象改造深度实战
  • 基于Python的反诈知识科普平台 Python+Django+Vue.js
  • 49 C++ STL模板库18-类模板-pair
  • 解决前端项目启动时找不到esm文件的问题
  • PostgreSQL 流程---更新