Oracle 为庆祝 MySQL 30 周年,截止到 2025.07.31 之前。所有人均可以免费考取原价245美元的MySQL OCP 认证。
从今天开始,将英文题库免费公布出来,并进行解析,帮助大家在一个月之内轻松通过OCP认证。
本期公布试题41~50
试题41:
On examination, your MySQL installation datadir has become recursively world
read/write/executable. What are two major concerns of running an installation with incorrect file privileges?
C)SQL injections could be used to insert bad data into the database. [错误]
D)Extra startup time would be required for the MySQL server to reset the privileges.(没有这个功能)
[错误]
A)Data files could be deleted. (datafiles) [正确]
E)MySQL binaries could be damaged, deleted, or altered.(basedir 中才有 MySQL binaries) [错误]
B)Users could overwrite configuration files.(mysqld-auto.ccnf) [正确]
解析
这道题目问的是当MySQL安装的数据目录(datadir)被递归设置为全局可读/写/执行时,会带来哪两个主要的安全隐患。
language
A) 数据文件可能被删除 (正确)
当datadir权限设置过于宽松时,任何系统用户都可以删除MySQL的数据文件,这会导致数据丢失和服务中断。
B) 用户可能覆盖配置文件 (正确)
特别是像mysqld-auto.cnf这样的配置文件可能被修改,这会影响MySQL服务器的行为和安全性。
错误选项解析
C) SQL注入可用于向数据库插入不良数据 (错误)
SQL注入与文件系统权限无关,这是应用程序层面的安全问题
D) MySQL服务器需要额外启动时间来重置权限 (错误)
MySQL服务器没有这样的功能来重置文件系统权限
E) MySQL二进制文件可能被损坏、删除或修改 (错误)
题目问的是datadir(数据目录)
试题42:
language
Choose three.Which three requirements must be enabled for group replication?
C)slave updates logging [正确]
E)primary key or primary key equivalent on every table [正确]
G)binary log ROW format [正确]
A)replication filters [错误]
D)binary log checksum [错误]
F)binary log MIXED format [错误]
B)semi-sync replication plugin [错误]
解析
Group Replication (组复制) 启用它必须满足以下三个核心要求
language
C) slave updates logging (正确)
必须启用二进制日志(binlog),因为组复制依赖于binlog来传播事务
E)primary key or primary key equivalent on every table [正确]
每个表必须有主键或等效的唯一非空索引
这是组复制识别和协调不同节点上数据变更的关键
G) binary log ROW format (正确)
必须使用ROW格式的二进制日志
这种格式能确保所有节点以相同方式应用变更
A) replication filters (错误)
复制过滤器(replication filters)实际上不能与组复制一起使用
D) binary log checksum (错误)
二进制日志校验和不是必需的,虽然可以启用但不是强制要求
F) binary log MIXED format (错误)
MIXED格式不满足要求,必须是ROW格式
B) semi-sync replication plugin (错误)
半同步复制插件不是组复制的组成部分
试题43:
language
You are attempting to start your mysqld.Examine this log output:
2019-12-12T22:21:40:353800z 0
System DCY-010116 Server /mysql/bin/mysqld mysld 8.0.18-comnercial starting as process 29740
2019-12-12T22:21:40:458802z 1 ERROR DCY-012592 InnoDB Operating system error number 2 in a file operation.
2019-12-12T22:21:40:459259z 1 ERROR DCY-012593 InnoDB The error means
the system cannot find the patjspecified.
2019-12-12T22:21:40:459423z 1 ERROR DCY-012594
InnoDB If you are installing InnoDB,remember that must create directories yourself ,InnoDB does not
create them.2019-12-12T22:21:40:459606z 1 ERROR DCY-012646 InnoDB File ./ibdatali 'open'
returned os error 71.Cannot continue operation.2019-12-12T22:21:40:459891z 1 ERROR DCY
012981 InnoDBCannot continue operation.Which two things must you check?
F)that the user attempting to connect to the database is using the correct username and password [错误]
E)for the presence of the missing files in other locations [正确]
A)the configuration file for correct datadir setting [正确]
D)for the possibility that the files are locked by another process [错误]
C)that the TLS/SSL certificates are still valid [错误]
B)that you are using the correct version of MySQL [错误]
解析
题目描述了一个MySQL启动失败的情况,错误日志显示InnoDB无法找到指定的路径和文件(操作系统错误code 2 71),提示系统找不到指定的路径。
language
F)that the user attempting to connect to the database is using the correct username and password [错误]
检查连接用户是否使用正确的用户名和密码 [错误]
这是启动阶段的错误,与用户认证无关
E)for the presence of the missing files in other locations [正确]
检查缺失的文件是否存在于其他位置 [正确]
错误提到"文件操作中出现操作系统错误号 2"(文件未找到)
需要确认 InnoDB 数据文件(如 ibdata1, ib_logfile0 等)是否被移动到了其他位置
A)the configuration file for correct datadir setting [正确]
检查配置文件中 datadir 设置是否正确 [正确]
错误日志明确显示"系统找不到指定的路径",这通常与 MySQL 数据目录(datadir)配置错误有关
需要检查 my.cnf 或 my.ini 配置文件中的 datadir 参数是否指向正确的目录
D)for the possibility that the files are locked by another process [错误]
检查文件是否被其他进程锁定 [错误]
错误代码2表示"文件未找到",不是"文件被锁定"
C)that the TLS/SSL certificates are still valid [错误]
检查 TLS/SSL 证书是否仍然有效 [错误]
错误与证书无关
B)that you are using the correct version of MySQL [错误]
检查是否使用了正确版本的 MySQL [错误]
错误与版本无关,是路径和文件问题
试题44:
language
Which three requirements must be enabled for group replication?
D)binary log MIXED format [错误]
C)binary log ROW format [正确]
G)slave updates logging [正确]
B)semi-sync replication plugin [错误]
A)primary key or primary key equivalent on every table [正确]
F)binary log checksum [错误]
E)replication filters [错误]
解析
MGR必要的三个条件
binlog必须开启,且需要为row格式,表需要有主键
试题45:
language
Choose two Which two statements are true about raw binary backups?
D)The data format is identical to how MySQL stores the data on disk. [正确]
C)The resulting files are easily human readable. [错误]
A)They are converted to a highly compressible binary format. [错误]
E)They are faster than logical backups because the process is a simple file or file system copy. [正确]
B)They are required to obtain FIPS security compliance. [错误]
解析
language
D) 数据格式与MySQL在磁盘上存储的数据格式完全相同 [正确]
技术解释:原始二进制备份直接复制MySQL的数据文件(如.ibd、.frm、ibdata1等),这些文件保持了MySQL在磁盘上的原始存储格式,没有进行任何转换
优势:保证了数据的完整性和一致性,恢复时可以直接使用
典型工具:XtraBackup、MySQL Enterprise Backup或直接文件系统复制
E) 它们比逻辑备份更快,因为过程是简单的文件或文件系统复制 [正确]
性能对比:原始二进制备份通常比逻辑备份(如mysqldump)快得多,因为它避免了:
数据从存储格式转换为SQL语句的过程
通过MySQL服务器层处理的开销
实现方式:直接操作文件系统,可以并行复制多个文件
C) 生成的文件很容易被人阅读 [错误]
原始二进制文件是专为MySQL存储引擎优化的二进制格式,不可读,需要专门的工具或MySQL服务器才能解析
A) 它们被转换为高度可压缩的二进制格式 [错误]
原始备份不转换数据格式,保持原样
虽然可以额外压缩这些文件,但这不是原始备份本身的特性
B) 它们需要获得FIPS安全合规性 [错误]
FIPS(联邦信息处理标准)合规性与备份方法无关,而是与加密算法和实现有关
试题46:
language
Choose two.Which two methods can be used to determine whether a query uses the hash join
algorithm?
A. EXPLAIN FORMAT=TREE
B. EXPLAIN FORMAT=JSON [正确]
C. EXPIAIN ANALYZE [正确]
D. EXPLAIN FORMAT=TRADIRIONAL
E. EXPIAIN without any formatting argument
解析
可以使用哪两种方法来确定查询是否使用 hash join 算法?
language
A. EXPLAIN FORMAT=TREE
虽然能显示执行计划树,但不明确标注哈希连接
不如JSON格式详细
D. EXPLAIN FORMAT=TRADITIONAL
传统表格格式只能通过Extra列的Using join buffer (hash join)间接判断
信息不如JSON格式明确
E. EXPLAIN without any formatting argument
默认等同于TRADITIONAL格式
哈希连接信息不够直观
正确答案BC
试题47:
Choose two.You have an InnoDB Cluster configured with three servers. Examine this command,
which executes successfully:mysqldump -uroot -p -d mydatabase > mydatabase_backup.sqlDue to
data loss, the cluster is initialized and a restore is attempted resulting in this error:ERROR 13176
(HY000) at line 23:Cannot update GTID_PURGED with the Group Replication plugin runningWhich
two actions, either one of which, can fix this error and allow a successful restore of the cluster?
C)Stop all instances except the primary read/write master instance and run the restore. [错误]
B)Remove the @@GLOBAL.gtid_executed statement from the dump file. [错误]
E)Remove the @@GLOBAL.gtid_purged statement from the dump file. [正确]
D)Restore using the --set-gtid-purged=OFF option. [错误]
A)Remove the group replication plugin from each instance before restoring. [错误]
F)Create the backup by using the --set-gtid-purged=OFF option. [正确]
解析
language
E) 从转储文件中移除@@GLOBAL.gtid_purged语句 [正确]
原因:该错误是因为Group Replication运行时不允许手动设置gtid_purged值
操作方法:
打开备份文件mydatabase_backup.sql
查找并删除包含SET @@GLOBAL.gtid_purged的行
保存文件后重新执行导入
F) 创建备份时使用--set-gtid-purged=OFF选项 [正确]
原因:这样生成的备份文件不会包含GTID信息,避免恢复时出现冲突
正确备份命令:
mysqldump -uroot -p -d --set-gtid-purged=OFF mydatabase > mydatabase_backup.sql
优势:这是预防性措施,比事后修改备份文件更可靠
错误选项分析
C) 停止除主读写实例外的所有实例并运行恢复 [错误]
Group Replication要求多数节点在线,停止节点可能导致集群不可用
不能解决GTID与Group Replication的根本冲突
B) 移除@@GLOBAL.gtid_executed语句 [错误]
备份文件中通常不会包含gtid_executed设置
这不是导致错误的原因
D) 恢复时使用--set-gtid-purged=OFF选项 [错误]
--set-gtid-purged是mysqldump的导出选项,不是导入选项
恢复时(mysql命令行)无法使用此选项
A) 从每个实例移除Group Replication插件后再恢复 [错误]
这会破坏集群配置,不是正确的解决方案
恢复后需要重新配置集群,复杂且风险高
试题48:
language
Choose three.Which three are types of InnoDB tablespaces?
D)temporary table tablespaces [正确]
C)redo tablespaces [错误]
F)encryption tablespaces [错误]
E)undo tablespaces [正确]
A)data tablespaces [正确]
B)schema tablespaces [错误]
解析
language
C) redo tablespaces [错误]
重做日志(redo log)使用日志文件而非表空间
重做日志文件通常命名为ib_logfile0, ib_logfile1等
F) encryption tablespaces [错误]
加密是表空间的一个特性,不是独立的表空间类型
B) schema tablespaces [错误]
InnoDB没有按schema(数据库)划分的表空间概念
试题49:
language
Choose two Examine this statement and output:mysql> SELECT ROW_NUMBER() OVER() AS QN,query, exec_count, avg_latency, lock_latency FROM sys.statement_analysisORDER BY exec_count;
(见下图)You must try to reduce query execution time. Which two queries should you focus on?

language
A)QN=2 [错误]
B)QN=3 [错误]
E)QN=5 [正确]
D)QN=1 [错误]
C)QN=4 [正确]
解析
看 avg_latency,执行次数多的 sql 语句已经没有优化的空间了。
试题50:
language
Choose two.You are asked to review possible options for a new MySQL instance. It will be a large,
busy reporting data warehousing instance.mysql innodb_data_file_path=Which two configurations
would satisfy long-term storage demands?
E)ibdata1:12M [错误]
F)ibdata1:12M:autoextend; ibdata2:12M:autoextend [错误]
D)ibdata1:12M; /tmp/ibdata2 :12M:autoextend [错误]
A)ibdata1:12M:autoextend [正确]
B)ibdata1:12M; ibdata2:12M:autoextend [正确]
C)ibdata1:12M; ibdata2:12M; ibdata3:12M [错误]
解析
language
A) ibdata1:12M:autoextend [正确]
优势:自动扩展(autoextend)特性可以满足数据仓库不断增长的需求
适用场景:适合存储需求不确定但可能持续增长的场景
注意事项:
需要监控磁盘空间,避免无限增长耗尽存储
默认扩展增量为8MB(可通过innodb_autoextend_increment调整)
B) ibdata1:12M; ibdata2:12M:autoextend [正确]
优势:结合了固定大小和可扩展文件,提供更灵活的存储管理
适用场景:
ibdata1提供基础存储
ibdata2在需要时自动扩展
额外好处:可以分散I/O负载到多个文件
C) ibdata1:12M; ibdata2:12M; ibdata3:12M [错误]
所有文件都是固定大小,无法满足数据仓库长期增长需求
当空间用尽时需要手动调整,不适合高可用性要求的环境
D) ibdata1:12M; /tmp/ibdata2:12M:autoextend [错误]
/tmp目录不适合存储永久数据(系统重启可能清空)
违反MySQL最佳实践,可能导致数据丢失
E) ibdata1:12M [错误]
纯固定大小配置,无法满足数据仓库增长需求
空间耗尽后实例将无法写入
F) ibdata1:12M:autoextend; ibdata2:12M:autoextend [错误]
虽然技术上可行,但配置冗余
两个文件都设置为autoextend没有实际优势,反而增加管理复杂度