MySQL 8.0 OCP 英文题库解析(十一)

Oracle 为庆祝 MySQL 30 周年,截止到 2025.07.31 之前。所有人均可以免费考取原价245美元的MySQL OCP 认证。

从今天开始,将英文题库免费公布出来,并进行解析,帮助大家在一个月之内轻松通过OCP认证。

本期公布试题91~100

试题91:

language 复制代码
Choose two.Which two statements are true about the data dictionary object cache? 
B)Character set and collation definition objects are not cached. [错误] 
A)The dictionary object caches use a Least Recently Used (LRU) algorithm to manage entries in each 
cache. [正确] 
D)If the dictionary object cache becomes full, MySQL server will be unable to create any more 
tables/objects. [错误] 
E)tablespace_definition_cache sets the number of tablespace objects that can be stored in the 
dictionary object cache. [正确] 
C)All dictionary object caches have a hard-coded size. [错误]

解析

language 复制代码
关于 MySQL 数据字典对象缓存(Data Dictionary Object Cache),正确的两个描述是:

    A) 字典对象缓存使用 LRU(Least Recently Used)算法管理缓存条目。 [正确]

    E) tablespace_definition_cache 参数控制表空间对象在字典对象缓存中的存储数量。 [正确]

    B) 字符集和排序规则定义不被缓存:
        错误:字符集和排序规则信息 会被缓存(如 character_sets、collations 表数据)。

    C) 所有字典对象缓存大小固定:
        错误:多数缓存大小可通过参数配置(如 table_definition_cache)。

    D) 缓存满时无法创建新表/对象:
        错误:缓存满时,MySQL 会 按 LRU 淘汰旧条目,不会阻止新对象创建。

试题92:

复制代码
Choose two.Examine this statement, which executes successfully:CREATE USER mary@192.0.2.100 
IDENTIFIED BY 'P@SSw0rd' REQUIRE NONE PASSWORD EXPIRE;Which two are true? 
A)Mary must connect using the username 'mary@192.0.2.100'. [错误] 
C)Mary must connect from the client machine 192.0.2.100. [正确] 
D)Mary cannot connect to the MySQL server until the DBA resets her password. [错误] 
B)Mary requires no password to connect to the MySQL server. [错误] 
E)Mary cannot query data until she changes her password. [正确] 

解析

language 复制代码
1. 连接必须来自指定 IP(C 正确)
    mary@192.0.2.100 的含义:
        用户 mary 只能从 IP 192.0.2.100 连接,其他 IP 会被拒绝。

2. 首次登录需修改密码(E 正确)
    PASSWORD EXPIRE 的作用:
        强制用户在首次登录时修改密码(通过 ALTER USER),否则只能执行重置密码操作,无法执行其他 SQL。
        若 Mary 未修改密码,执行查询会报错

    A) 必须使用用户名 'mary@192.0.2.100' 连接:
        错误:连接时只需用户名 mary,主机部分由 MySQL 自动匹配。

    B) 无需密码连接:
        错误:IDENTIFIED BY 'P@SSw0rd' 明确要求密码。

    D) 需 DBA 重置密码才能连接:
        错误:Mary 可自行登录并修改密码(除非账户被锁定)。

试题93:

复制代码
Choose two.Examine this command, which executes successfully on InnoDB 
Cluster:dba.dropMetadataschema ()Which two statements are true? 
D)Connections driven by MySQL Router are not affected by the command. [错误] 
A)The mysql_innodb_cluster_metadata schema is dropped from the instance where the connection 
was established. [错误] 
E)The mysql_innodb_cluster_metadata schema is dropped from all reachable members of the cluster. 
[正确] 
F)Group Replication will be dissolved and all metadata purged. [错误] 
C)The command drops the mysql_innodb_cluster_metadata schema and re-creates it. [错误] 
B)Group Replication is still operational, but InnoDB Cluster must be reimported under MySQL Shell. 
[正确] 

解析

language 复制代码
在 InnoDB Cluster 中执行 dba.dropMetadataSchema() 命令时,正确的两个描述是:

E) mysql_innodb_cluster_metadata 模式会从集群所有可达成员中删除。 [正确]

B) Group Replication 仍保持运行,但需在 MySQL Shell 中重新导入 InnoDB Cluster。 [正确]


    A) 仅删除当前连接实例的元数据(错误):

        操作是全局的,影响所有可达成员(E 正确)。

    C) 删除后重新创建元数据(错误):

        不会自动重建,需手动重新配置集群。

    D) MySQL Router 连接不受影响(错误):

        Router 依赖元数据路由请求,元数据删除后其功能将失效,需重启或重新引导。

    F) Group Replication 解散(错误):

        仅元数据被清除,复制组仍存在(但需修复元数据以恢复集群管理)。

试题94:

复制代码
Choose two.User account baduser@hostname on your MySQL instance has been compromised. 
Which two commands stop any new connections using the compromised account? 
B)ALTER USER baduser@hostname DEFAULT ROLE NONE; [错误] 
D)ALTER USER baduser@hostname IDENTIFIED WITH mysql_no_login; [正确] 
A)ALTER USER baduser@hostname PASSWORD DISABLED; [错误] 
E)ALTER USER baduser@hostname ACCOUNT LOCK; [正确] 
C)ALTER USER baduser@hostname MAX_USER_CONNECTIONS 0; [错误] 

解析

language 复制代码
MySQL 实例上的用户账户baduser@hostname已被盗用。哪两个命令会停止使用被盗账户的任何新连接?
在 MySQL 中,阻止被入侵账户 baduser@hostname 建立新连接的两种有效方法是:

D) ALTER USER baduser@hostname IDENTIFIED WITH mysql_no_login; [正确]
E) ALTER USER baduser@hostname ACCOUNT LOCK; [正确]


A) PASSWORD DISABLED:
        无效语法,MySQL 不支持直接禁用密码。

B) DEFAULT ROLE NONE:
        仅移除默认角色,不影响账户连接权限。

C) MAX_USER_CONNECTIONS 0:
        不生效,0 表示无限制,应设为 1 限制连接数(但仍有漏洞)。

试题95:

复制代码
Choose two.Which two are use cases of MySQL asynchronous replication? 
A)You can scale reads by adding multiple slaves. [正确] 
C)You can scale writes by creating a replicated mesh. [错误] 
D)It guarantees near real-time replication between a master and a slave. [错误] 
E)It allows backup to be done on the slave without impacting the master. [正确] 
B)MySQL Enterprise Backup will automatically back up from an available slave. [错误]

解析

language 复制代码
在 MySQL 异步复制(Asynchronous Replication)的应用场景中,正确的两个选项是:

A) 通过添加多个从库(Slave)扩展读操作 [正确]

E) 在从库执行备份不影响主库(Master) [正确]

B) MySQL Enterprise Backup 自动从从库备份(错误)
    MEB 不会自动选择从库,需手动指定备份源(如--slave-info参数)。

C) 通过复制网状结构扩展写入(错误)
    异步复制是单向主从架构,扩展写入需使用多主复制(如Group Replication)。

D) 保证主从近实时同步(错误)
    异步复制不保证实时同步,从库数据可能存在延迟(强一致性需半同步复制)。

试题96:

复制代码
Choose two.Examine this command, which executes successfully:mysqlpump --user=root -
password > full_backup.sql Which two databases will be excluded from this dump? 
A)mysql [错误] 
B)information_schema [正确] 
D)employee [错误] 
C)world [错误] 
E)sys [正确]

解析

language 复制代码
在给定的 mysqlpump 命令中,默认会被排除的两个数据库是:

B) information_schema [正确]
E) sys [正确]

1. information_schema(B 正确)

    原因:
        information_schema 是 MySQL 的元数据数据库,存储表、列、权限等系统信息。
        这些数据是动态生成的,不需要(也无法)通过备份恢复。
    mysqlpump 行为:
        默认跳过 information_schema,因为它的内容在恢复时会自动重建。

2. sys(E 正确)
    原因:
        sys 数据库是 MySQL 的性能诊断工具库,基于 performance_schema 提供视图。
        其内容也是动态生成的,备份无意义。
    mysqlpump 行为:
        默认跳过 sys,除非显式指定 --include-databases=sys。

试题97:

复制代码
Choose two A valid raw backup of the shop.customers MyISAM table was taken. You must restore 
the table.You begin with these steps:
1.Confirm that secure_file_priv= '/var/tmp '
2.mysql> DROP TABLE shop.customers;
3.shell> cp /backup/customers.MY* /var/1ib/mysql/shop/
Which two actions are required to complete the restore? 

B)mysql> SOURCE '/var/tmp/customers.sdi [错误] 
E)shell> cp /backup/customers.frm /var/1ib/mysql/shop/ [错误] 
H)mysql> ALTER TABLE shop.customers IMPORT TABLESPACE [错误] 
A)shell> cp /backup/customers.sdi /var/tmp [正确] 
D)mysql> ALTER TABLE shop.customers DISCARD TABLESPACE [错误] 
C)shell> cp /backup/customers.sdi /var/1ib/mysql/shop/ [错误] 
G)mysql> IMPORT TABLE FROM /var/tmp/customers.sdi [正确] 
F)mysql> IMPORT TABLE FROM /var/1ib/mysql/shop/customers.sdi. [错误]

解析

language 复制代码
在恢复 MyISAM 表 shop.customers 的过程中,完成恢复所需的两个操作是:

A) shell> cp /backup/customers.sdi /var/tmp [正确]
G) mysql> IMPORT TABLE FROM '/var/tmp/customers.sdi' [正确]


MyISAM 表恢复步骤:

    复制数据文件(.MYD 和 .MYI)到 datadir(已执行)。
    复制 .sdi 文件到 secure_file_priv 目录(A 正确)。
    执行 IMPORT TABLE 加载元数据(G 正确)。

    注意:
        确保 secure_file_priv 配置正确(步骤 1 已确认)。
        MyISAM 恢复无需 ALTER TABLE 操作(D/H 错误)。

试题98:

复制代码
Choose two.Which two MySQL Shell commands are excluded from the InnoDB Cluster creation 
procedure? 
F)dba.createCluster () #创建集群 [错误] 
B)dba.configureLocalInstance () ##持久化配置信息 [错误] 
G)cluster.forceQuorumUsingPartitionOf () #将集群从 quorum 丢失场景恢复到可操作状态。如果一个组
被分区或发生的崩溃超过了可容忍的范围,则可能会出现这种情况。 [正确] 
D)cluster.setPrimaryInstance() ##设置主节点 [正确] 
A)cluster.addInstance () #添加节点 [错误] 
C)dba.checkInstanceConfiguration() ##检查节点 [错误] 
E)dba.configureInstance() ##检查配置 [错误]

解析

language 复制代码
在 MySQL InnoDB Cluster 创建过程 中,不包含 的两个命令是:

G) cluster.forceQuorumUsingPartitionOf() [正确]
D) cluster.setPrimaryInstance() [正确]

    创建集群的关键步骤:

        dba.checkInstanceConfiguration() → 检查配置
        dba.configureInstance() → 配置实例
        dba.createCluster() → 创建集群
        cluster.addInstance() → 添加节点

    排除的命令:
        cluster.forceQuorumUsingPartitionOf()(G)→ 故障恢复专用
        cluster.setPrimaryInstance()(D)→ 手动切换主节点

试题99:

复制代码
Choose two.Examine this command, which executes successfully:
shell> mysqldump --master-data=2 --single-transaction --result-file=dump.sql mydb Which two statements are true? 

E)It executes flush tables with read lock. [正确] 
C)It is a cold backup. [错误] 
A)This option uses the READ COMMITTED transaction isolation mode. [错误] 
B)It enforces consistent backups for all storage engines. [错误] 
D)The backup created is a consistent data dump. [正确] 

解析

language 复制代码
mysqldump命令的使用
FLUSH TABLES WITH READ LOCK(E 正确)
    --master-data=2 的作用:
        在备份开始时,短暂获取全局读锁(FLUSH TABLES WITH READ LOCK)以记录二进制日志位置(binlog 坐标)。
        随后立即释放锁(因为 --single-transaction 启动了事务)。

一致的备份数据(D 正确)
    --single-transaction 的作用:
        对 InnoDB 表 使用事务隔离(REPEATABLE READ),确保备份期间数据视图一致。
        非 InnoDB 表(如 MyISAM)仍需依赖全局锁,但此命令未显式锁定它们。

    A) 使用 READ COMMITTED 隔离级别(错误)
        --single-transaction 默认使用 REPEATABLE READ(InnoDB 的默认隔离级别)。

    B) 保证所有存储引擎的一致性(错误)
        仅 InnoDB 表能通过事务保证一致性,MyISAM 等引擎可能不一致(除非显式加锁)。

    C) 冷备份(错误)
        热备份(在线备份),因为数据库在备份期间仍可读写(InnoDB 表)。

试题100:

language 复制代码
Choose two.Which two methods allow a DBA to reset a user's password? 
B)mysql_secure_installation utility [错误] 
A)SET PASSWORD statement [正确] 
E)mysqladmin client program [错误] 
D)GRANT statement [错误] 
C)ALTER USER statement [正确]

解析

language 复制代码
    B) mysql_secure_installation 工具:
        仅用于 初始化服务器安全配置(如设置 root 密码、删除匿名用户等),不能重置普通用户密码。

    D) GRANT 语句:
        MySQL 8.0+ 已废弃 用 GRANT 修改密码的功能(早期版本可用 GRANT ... IDENTIFIED BY)。

    E) mysqladmin 客户端程序:
        仅能修改 当前连接用户 的密码(如 mysqladmin password "new_password"),不能重置其他用户密码。

正确选项 A C
相关推荐
大白要努力!5 小时前
MySQL 8.0 + Navicat 完整操作指南
数据库·mysql
云絮.6 小时前
数据库操作
数据库·mysql·算法·oracle
设计师小聂!8 小时前
宝塔 Linux 面板保姆级教程
linux·mysql·开源·运维开发
Tong Z9 小时前
Mysql DDL中的ALGORITHM
数据库·mysql
啊森要自信9 小时前
【GUI自动化测试】控件、鼠标键盘操作与多场景自动化
c语言·开发语言·python·adb·ipython
minji...13 小时前
MySQL数据库 (七) MySQL表的基本查询(上),insert、replace、select、where、order by
数据库·mysql·select·replace·insert·order by·where
折戟不必沉沙15 小时前
mysql忘记密码
数据库·mysql
kuonyuma15 小时前
MyBatis入门·注解操作
java·spring boot·mysql·spring·mybatis
聪明努力的积极向上15 小时前
【claude code】MySQL MCP 配置完整指南
数据库·mysql·ai编程
DIY源码阁15 小时前
JavaSwing酒店管理系统 - MySQL版
java·mysql·eclipse