MySQL 8.0 OCP 英文题库解析(三)
Oracle 为庆祝 MySQL 30 周年,截止到 2025.07.31 之前。所有人均可以免费考取原价245美元的MySQL OCP 认证。
从今天开始,将英文题库免费公布出来,并进行解析,帮助大家在一个月之内轻松通过OCP认证。
本期公布试题16~25
试题16:
choose two.Examine the modified output:mysql>
SHOW SLAVE STATUS\G
******************1. row********************
Slave_IO_Running:Yes
Slave_SQL_Running:Yes
Seconds_Behind_Master:1612
Seconds_Behind_Master value is steadily growing. What are two possible causes? B)This value shows only I/O latency and is not indicative of the size of the transaction queue. [错误] A)The master is producing a large volume of events in parallel but the slave is processing them serially. [正确] C)One or more large tables do not have primary keys. [错误] E)The parallel slave threads are experiencing lock contention. [错误] D)The master is most probably too busy to transmit data and the slave needs to wait for more data. [正确]
解析
本题考查主从问题,从题目中可以看到IO线程和SQL线程均正常,延迟有1612秒,题目问造成主从延迟持续稳定增长的两种可能的原因是什么?
B)This value shows only I/O latency and is not indicative of the size of the transaction queue. [错误]
该值仅显示 I/O 延迟,并不表示事务队列的大小。
该指标反映的是SQL线程与I/O线程的整体延迟,不仅是I/O延迟A)The master is producing a large volume of events in parallel but the slave is processing them serially. [正确]
主服务器正在并行生成大量事件,但从服务器正在串行处理它们。这是造成延迟的一个原因之一,正确。C)One or more large tables do not have primary keys. [错误]
一个或多个大型表没有主键。无主键表会导致复制效率降低,但不会直接表现为延迟持续增长E)The parallel slave threads are experiencing lock contention. [错误]
并行从属线程遇到锁争用。并行复制线程锁竞争会导致延迟波动,而非稳定增长D)The master is most probably too busy to transmit data and the slave needs to wait for more data. [正确]
主服务器很可能太忙而无法传输数据,而从服务器需要等待更多数据。选项正确原因:主库网络带宽不足或负载过高时,Binlog传输速度会变慢从库I/O线程无法及时获取新事件,导致SQL线程空闲等待表现为Slave_IO_Running: Yes但延迟持续增加对于选项A的情况,可考虑启用从库的并行复制功能(slave_parallel_workers)
对于选项D的情况,需检查主库网络状况和binlog_dump线程状态
试题17:
Choose two.Which two are true about binary logs used in asynchronous replication?
A)The master connects to the slave and initiates log transfer. [错误]
B)They contain events that describe all queries run on the master. [错误]
D)They are pulled from the master to the slave. [正确]
C)They contain events that describe database changes on the master. [正确]
E)They contain events that describe only administrative commands run on the master. [错误]
解析
关于异步复制中使用的二进制日志,哪两个是正确的?
A)The master connects to the slave and initiates log transfer. [错误]
主服务器连接到从服务器并启动日志传输。
错误 - 主库不会主动连接从库,复制方向完全由从库发起B)They contain events that describe all queries run on the master. [错误]
它们包含描述在 master 上运行的所有查询的事件。
错误 - 二进制日志不记录所有查询(如SELECT/show等只读操作不会被记录)D)They are pulled from the master to the slave. [正确]
它们从 master 拉到 slave。C)They contain events that describe database changes on the master. [正确]
它们包含描述主服务器上的数据库更改的事件。
二进制日志记录的是"数据变更事件"(如DML语句、表结构变更等),而非原始SQL语句
以"事件"形式记录能保证跨版本兼容性和确定性执行
注意:binlog_format=ROW时记录行变更,STATEMENT时记录原始SQL(但仍是事件形式封装)E)They contain events that describe only administrative commands run on the master. [错误] 它们包含仅描述在主服务器上运行的管理命令的事件
不仅记录管理命令,所有数据变更(INSERT/UPDATE等)都会记录
试题18:
You have appropriate privileges and are about to shut down a running MySQL server process on Oracle Linux 7.Which three are valid methods that will shut down the MySQL server? E)mysqld_safe --shutdown [错误]
A)mysqld_safe -S /tmp/mysql.sock SHUTDOWN [错误]
B)kill mysqld_safe [错误]
F)systemctl stop mysqld [正确]
G)mysql> SHUTDOWN; [正确]
D)mysql -S /tmp/mysql.sock --shutdown [错误]
C)mysqladmin shutdown [正确]
解析
您具有适当的权限,并且即将关闭 Oracle Linux 7 上正在运行的 MySQL 服务器进程。哪三种方法是将关闭 MySQL 服务器的有效方法?
E)mysqld_safe --shutdown [错误]
mysqld_safe不支持--shutdown参数(这是早期版本的误传)A)mysqld_safe -S /tmp/mysql.sock SHUTDOWN [错误]
mysqld_safe没有-S参数,也不接受SHUTDOWN指令B)kill mysqld_safe [错误]
直接kill mysqld_safe进程可能导致非正常关闭F)systemctl stop mysqld [正确] G)mysql> SHUTDOWN; [正确] D)mysql -S /tmp/mysql.sock --shutdown [错误]
mysql客户端没有--shutdown参数C)mysqladmin shutdown [正确]
MySQL官方提供的管理工具
试题19:
Choose two.Examine this MySQL Shell command:dba.rebootClusterFromCompleteOutage () Which two statements are true? E)It reconfigures InnoDB Cluster if the cluster was stopped. [错误]
D)It performs InnoDB Cluster instances rolling restart. [正确]
A)It stops and restarts all InnoDB Cluster instances and initializes the metadata. [错误]
F)It picks the minimum number of instances necessary to rebuild the quorum and reconfigures
InnoDB Cluster. [错误]
C)It is not mandatory that all instances are running and reachable before running the command. [正确]
B)It only stops and restarts all InnoDB Cluster instances. [错误]
G)It only starts all InnoDB Cluster instances. [错误]
解析
本题考查mysql shell的使用,dba.rebootClusterFromCompleteOutage() 是 MySQL Shell 中用于 从完全宕机状态恢复 InnoDB Cluster 的关键命令,主要解决集群因意外故障导致所有节点不可用后的恢复问题。
正确选项:
D) 执行InnoDB Cluster实例的滚动重启
C) 运行该命令前不要求所有实例都必须在线且可访问E)It reconfigures InnoDB Cluster if the cluster was stopped. [错误]
如果集群已停止,它会重新配置 InnoDB Cluster
错误:描述不准确,该命令专为完全宕机场景设计D)It performs InnoDB Cluster instances rolling restart. [正确]
它执行 InnoDB Cluster 实例滚动重启A)It stops and restarts all InnoDB Cluster instances and initializes the metadata. [错误]
它会停止并重新启动所有 InnoDB Cluster 实例并初始化元数据。
错误,不会显式停止实例,而是针对已停止的集群进行恢复F)It picks the minimum number of instances necessary to rebuild the quorum and reconfigures InnoDB Cluster. [错误]
它选择重建 quorum 所需的最小实例数并重新配置 InnoDB Cluster。
错误:不是选择"最少实例",而是基于现存实例重建仲裁C)It is not mandatory that all instances are running and reachable before running the command. [正确]
在运行命令之前,并非所有实例都正在运行且可访问。B)It only stops and restarts all InnoDB Cluster instances. [错误]
它仅停止并重新启动所有 InnoDB Cluster 实例。
错误:并非简单重启,重点是重建集群元数据和拓扑G)It only starts all InnoDB Cluster instances. [错误]
它仅启动所有 InnoDB Cluster 实例
错误:包含元数据重建等复杂操作,非单纯启动实例
试题20:
Choose two.Examine this command and output:(见下图)Which two options will improve the security of the MySQL instance?
D)Change the parent directory owner and group to mysql. [错误]
A)Remove the world read/execute privilege from the accounting directory. [正确]
F)Remove group read/write privileges from the private_key.pem file. [正确]
E)Remove world read privileges from the server-cert.pem certificate file. [错误]
B)Remove world read privileges from the public_key.pem file. [错误]
C)Change the group ownership of the mysql directory to the mysql user group. [错误]
解析
哪两个选项将提高 MySQL 实例的安全性?
A) 移除accounting目录的全局读/执行权限
F) 移除private_key.pem文件的组读写权限D)Change the parent directory owner and group to mysql. [错误]
修改父目录属主为mysql
父目录已属于mysql:mysql,无需修改(且可能影响其他服务)。A)Remove the world read/execute privilege from the accounting directory. [正确]
目录权限为 drwxrwxr-x 表示其他用户(world)有读和执行权限,可能导致未授权用户遍历目录内容。F)Remove group read/write privileges from the private_key.pem file. [正确]
private_key.pem权限为 rw-rw---- 表示同组用户有读写权限,私钥文件应严格限制访问。E)Remove world read privileges from the server-cert.pem certificate file. [错误]
移除server-cert.pem的全局读权限
证书文件(权限rw-r--r--)需被客户端读取,限制后会导致连接失败。B)Remove world read privileges from the public_key.pem file. [错误]
移除public_key.pem的全局读权限
公钥本身设计为可公开分发,无需限制读取(权限rw-r--r--已合理)。C)Change the group ownership of the mysql directory to the mysql user group. [错误]
修改 mysql 目录的组所有权为 mysql 用户组
无需更改。
试题21:
Choose two.Which two statements are true about general tablespaces?
A)General tablespaces support temporary tables. [错误]
B)Dropping a table from a general tablespace releases the space back to the operating system. [错误]
C)An existing table can be moved into a general tablespace. [正确]
E)A new table can be created explicitly in a general tablespace. [正确]
D)A general tablespace can have multiple data files. [错误]
解析
这道题和试题13一模一样,只是选项换了换。再来看下general 表空间的使用
A)General tablespaces support temporary tables. [错误]
B)Dropping a table from a general tablespace releases the space back to the operating system. [错误]
C)An existing table can be moved into a general tablespace. [正确]
E)A new table can be created explicitly in a general tablespace. [正确]
D)A general tablespace can have multiple data files. [错误] 本题考查general表空间的使用
B)Dropping a table from a general tablespace releases the space back to the operating system. [错误]
从通用表空间删除表会释放空间回操作系统
错误:通用表空间的空间不会自动释放回操作系统
需要手动执行ALTER TABLESPACE … DROP DATAFILE来释放空间D) 一个通用表空间可以有多个数据文件
错误:每个通用表空间只能有一个数据文件(.ibd文件)
但可以动态扩展这个数据文件的大小A) 通用表空间支持临时表
错误:通用表空间不支持临时表
临时表只能存储在临时表空间或独立表空间中E) 可以显式地在通用表空间中创建新表
使用CREATE TABLE … TABLESPACE tablespace_name语法
例如:CREATE TABLE t1 (id INT) TABLESPACE ts1;C) 可以将现有表移动到通用表空间中
使用ALTER TABLE … TABLESPACE语法
例如:ALTER TABLE t1 TABLESPACE ts1;
试题22:
Choose three.Examine this command, which executes successfully:cluster.addInstance( '
<user>@<host>:<port>' , recoveryMethod:' clone ')
Which three statements are true? D)The account used to perform this recovery needs the BACKUP_ADMIN privilege. [正确]
E)A new instance is installed, initialized, and provisioned with data from an instance already in the
cluster and joined to the cluster. [错误]
B)InnoDB tablespaces outside the datadir are able to be cloned. [正确]
C)A target instance must exist, then it will be provisioned with data from an instance already in the
cluster and joined to the cluster. [正确]
A)It is always slower than recoveryMethod:' incremental ' . [错误]
F)InnoDB redo logs must not rotate for the duration of the execution; otherwise, the recovery will
fail. [错误]
解析
下是关于 cluster.addInstance() 使用 recoveryMethod: ‘clone’ 方法的三个正确选项及其解析:
D)The account used to perform this recovery needs the BACKUP_ADMIN privilege. [正确]
执行此恢复操作的账户需要 BACKUP_ADMIN 权限E)A new instance is installed, initialized, and provisioned with data from an instance already in the
cluster and joined to the cluster. [错误]
新实例会被安装、初始化并直接从集群中的实例克隆数据后加入集群
错误原因:clone 恢复方法 不会自动安装 MySQL 实例,仅适用于已存在但无数据的实例。B)InnoDB tablespaces outside the datadir are able to be cloned. [正确]
可以克隆位于 datadir 之外的 InnoDB 表空间
克隆操作会复制所有 InnoDB 表空间,包括使用 CREATE TABLESPACE 创建的通用表空间(即使不在默认数据目录内)。
例外:临时表空间(temporary tablespaces)不会被克隆。C)A target instance must exist, then it will be provisioned with data from an instance already in the
cluster and joined to the cluster. [正确]
目标实例必须已存在,随后会从集群中的现有实例克隆数据并加入集群A)It is always slower than recoveryMethod:' incremental ' . [错误]
它总是比 recoveryMethod: 'incremental' 慢
错误原因:克隆速度取决于数据量,增量恢复(incremental)可能更慢(需应用大量 binlog)。F)InnoDB redo logs must not rotate for the duration of the execution; otherwise, the recovery will fail. [错误]
执行期间 InnoDB 重做日志不能轮转,否则恢复会失败
错误原因:克隆过程不依赖重做日志(redo log),而是直接复制数据文件,日志轮转不影响操作。
试题23:
Choose three.Which three sets of item information are visible in the mysql system database?
G)information about table structures [错误]
F)rollback segments [错误]
E)performance monitoring information [错误]
C)plugins [正确]
D)audit log events [错误]
B)help topics [正确]
A)time zone information and definitions [正确]
解析
mysql 系统数据库中可以看到哪三组监控项信息?
G)information about table structures [错误]
表结构信息
实际存储位置:表结构(元数据)存储在 information_schema 或 performance_schema 数据库,而非 mysql 库。F)rollback segments [错误]
回滚段信息
实际存储位置:InnoDB 回滚段信息可通过 information_schema.innodb_trx 或 performance_schema 查看,与 mysql 库无关。E)performance monitoring information [错误]
性能监控信息
实际存储位置:性能数据主要在 performance_schema 或 sys 数据库,mysql 库不存储监控数据。C)plugins [正确]
mysql.plugin 表存储已安装的插件信息(如认证插件、存储引擎插件等)。D)audit log events [错误]
审计日志事件
实际存储位置:若启用审计日志,通常存储于专用文件或 audit_log 插件管理的表中,默认不在 mysql 库。B)help topics [正确]
mysql.help_topic 表包含 MySQL 内置的帮助文档内容(如 SQL 语法说明)。A)time zone information and definitions [正确]
时区信息与定义 (time zone information)
mysql.time_zone* 系列表存储时区数据(需手动加载)
关键表:mysql.time_zone:时区名称mysql.time_zone_leap_second:闰秒信息mysql.time_zone_transition:时区转换规则
试题24:
Which two situations will cause the binary log to rotate?
A)FLUSH HOSTS executed [错误]
D)SET sql_ log bin-1 executed [错误]
C)max_ binloq cache size exceeded [错误]
B)max binlog_size exceeded [正确]
F)FLUSH LOGS executed [正确]
E)SET syne binlog-l executed1 [错误]
解析
哪两种情况会导致 binlog 切换?
A)FLUSH HOSTS executed [错误]
执行 FLUSH HOSTS
清空主机缓存(如连接错误记录),与二进制日志无关。D)SET sql_log bin-1 executed [错误]
执行 SET sql_log_bin=0
临时禁用当前会话的二进制日志记录,不会触发轮换。C)max_binlog cache size exceeded [错误]
max_binlog_cache_size 超出限制
控制单个事务允许的最大缓存大小,超限会报错(Multi-statement transaction required more than 'max_binlog_cache_size'),但不会轮换日志文件。B)max binlog_size exceeded [正确]
当当前二进制日志文件大小达到 max_binlog_size 参数(默认 1GB)时,MySQL 会自动创建一个新的二进制日志文件。
注意:实际文件可能略微超过设定值,因为轮换仅在事务完成后触发。F)FLUSH LOGS executed [正确]
手动执行 FLUSH LOGS 会强制关闭当前二进制日志文件并立即创建一个新文件。E)SET sync_binlog l executed1 [错误]
控制制二进制日志同步到磁盘的频率,不触发轮换
试题25:
Choose three.Which three statements are true about MySQL replication?
D) Any instance can have multiple slaves, but it can have only one master. [错误]
G) Binary logging must be enabled on the master in order to replicate to other instances. [正确]
E) Binary logs contain only transactions originating from a single MySQL instance. [错误]
F) Replication can use only TCP/IP connections. [正确]
C) Each instance in a replication topology must have a unique server ID. [正确]
A) Each slave must have its own MySQL user for replication. [错误]
B) A replication user must have the SELECT privilege for all tables that need to be replicated. [错误]
解析
关于 MySQL 复制,哪三个陈述是正确的?
D) Any instance can have multiple slaves, but it can have only one master. [错误]
任何实例可以有多个从库,但只能有一个主库
错误原因:MySQL 支持多主复制(如环形复制、组复制),并非只能单主。 G) Binary logging must be enabled on the master in order to replicate to other instances. [正确]
主库必须启用二进制日志(Binary Log)才能复制到其他实例E) Binary logs contain only transactions originating from a single MySQL instance. [错误]
二进制日志仅包含来自单个 MySQL 实例的事务
错误原因:二进制日志记录所有数据变更,包括来自其他实例的中继事件(在级联复制中)。F) Replication can use only TCP/IP connections. [正确]
复制仅能使用 TCP/IP 连接,MySQL 复制默认通过 TCP/IP 协议通信,不支持 Unix Socket 或其他协议。C) Each instance in a replication topology must have a unique server ID. [正确]
复制拓扑中的每个实例必须具有唯一的 server ID
server_id 用于标识复制拓扑中的每个节点,必须全局唯一(否则导致数据混乱)。A) Each slave must have its own MySQL user for replication. [错误]
每个从库必须有自己的 MySQL 复制用户
错误原因:所有从库可共享同一个主库的复制账号(只需主库授权一次)。B) A replication user must have the SELECT privilege for all tables that need to be replicated. [错误]
复制用户需要对所有复制的表具有 SELECT 权限
错误原因:复制用户仅需 REPLICATION SLAVE 权限,无需数据读取权限
未完,待续。后续题库会陆续发出,请关注。