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

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

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

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

微信图片_20250507171214.png

本期公布试题171~180

试题171:
Choose the best answer.Examine this command and output:(见下图)Which statement is true?
图片.png

A)Firewall_cached_entries is the number of statements found in the query cache for users in 
DETECTING mode. [错误] 
D)Firewall_access_granted is the number of connections granted from whitelisted hosts. [错误] 
B)Firewall_access_suspicious is the number of statements logged as suspicious for users in 
DETECTING mode. [正确] 
C)Firewall_access_denied is the number of connection attempts from prohibited hosts that are 
denied. [错误] 

解析

正确选项B解析:
Firewall_access_suspicious 表示在DETECTING模式下被记录为可疑的语句数量。这是正确的描述,因为:DETECTING模式仅记录不匹配白名单的语句而不阻止这些不匹配的语句会被标记为"suspicious"(可疑)该变量统计这类事件的发生次数A) Firewall_cached_entries正确含义:该变量表示MySQL企业防火墙当前缓存的所有规范化SQL语句数量(包括PROTECTING/DETECTING/RECORDING所有模式下的缓存),而不仅限于DETECTING模式。缓存用于快速匹配已知语句模式。B) Firewall_access_suspicious含义:记录处于DETECTING模式的用户执行被标记为"可疑"的SQL语句次数。DETECTING模式下防火墙仅监控不拦截,但会标记不符合白名单规则的语句。C) Firewall_access_denied正确含义:该变量统计因违反防火墙规则而被拒绝执行的SQL语句数量(针对PROTECTING模式),而非连接层面的拒绝。连接拒绝通常由网络层安全机制控制。D) Firewall_access_granted正确含义:记录符合防火墙白名单规则并被允许执行的SQL语句数量(所有模式下的总和),与主机连接无关。白名单通过先前的RECORDING模式学习生成。

试题172:

Choose the best answer.Examine this output:(见下图)Which change should optimize the number 
of buffer pool instances for this workload? 
图片地址: https://oss-emcsprod-public.modb.pro/image/exam/question_1641375418395.jpg 
A)Decrease the number of buffer pool instances to 4. [错误] 
E)Increase the number of buffer pool instances to 12. [正确] 
B)Increase the number of buffer pool instances to 16. [错误] 
D)Decrease the number of buffer pool instances to 1. [错误] 
C)Increase the number of buffer pool instances to 32. [错误]

图片.png

解析

正确选项:E) 增加到12个实例 [正确]
优化依据经验法则:通常建议每1GB缓冲池配置1个实例,12GiB对应12个实例更合理并发负载:系统有16个活跃运行线程(threads_running),增加实例数可以减少争用当前配置不足:8个实例对于12GiB缓冲池偏少,可能导致热点争用块大小兼容:128MiB的chunk size与12个实例组合能有效利用12GiB内存(12×1GiB=12GiB)

试题173:

Choose the best answer.You encountered an insufficient privilege error in the middle of a long 
transaction. The database administrator is informed and immediately grants the required 
privilege:GRANT UPDATE ON world.city TO 'user1' ;How can you proceed with your transaction with 
the least interruption? 
D)Change the default database and re-execute the failed statement in your transaction. [错误] 
B)Re-execute the failed statement in your transaction. [正确] 
A)Close the connection, reconnect, and start the transaction again. [错误] 
C)Roll back the transaction and start the transaction again in the same session. [错误]

解析

D) 更改默认数据库并在事务中重新执行失败的语句 [错误]
B) 在事务中重新执行失败的语句 [正确]
A) 关闭连接,重新连接,然后重新开始事务 [错误]
C) 回滚事务并在同一会话中重新开始事务 [错误]正确选项:B) 在事务中重新执行失败的语句原因:MySQL权限检查是在语句执行时进行的,不是事务开始时管理员授予权限后,只需重新执行之前因权限不足失败的语句即可事务会保持活动状态,之前已执行的语句效果仍然保留这是中断最小、最高效的恢复方式

试题174:

Choose the best answer.There has been an accidental deletion of data in one of your MySQL 
databases.You determine that all entries in the binary log file after position 1797 must be replayed. 
Examine this partial command:mysqlbinlog binlog.000008 --start-position=1798 Which operation 
will complete the command? 
C)It can be piped into the MySQL Server via the command-line client. [正确] 
A)--write-to-remote-server must be added to the command line to update the database tables. [错
误] 
D)You must use --stop position=1797 to avoid the DELETE statement that caused the initial 
problem. [错误] 
B)No changes required. It automatically updates the MySQL Server with the data. [错误] 

解析

请选择最佳答案。您的某个MySQL数据库中发生了数据意外删除。您确定必须重放二进制日志文件(binlog)中位置1797之后的所有条目。查看这个部分命令:
mysqlbinlog binlog.000008 --start-position=1798C) 可以通过命令行客户端管道传输到MySQL服务器 [正确]
A) 必须在命令行添加--write-to-remote-server来更新数据库表 [错误]
D) 必须使用--stop-position=1797以避免导致初始问题的DELETE语句 [错误]
B) 无需更改,它会自动用数据更新MySQL服务器 [错误]
中文解析正确选项:C) 可以通过命令行客户端管道传输到MySQL服务器原因:mysqlbinlog工具本身只读取和显示二进制日志内容,不会自动执行需要将输出通过管道(|)传递给mysql客户端来实际执行:
mysqlbinlog binlog.000008 --start-position=1798 | mysql -u username -p这是标准的数据恢复流程,可以精确控制要重放的日志位置允许在重放前先检查日志内容(加-v参数查看实际SQL)

试题175:

Choose the best answer.The mysqld instance has the connection control plugin enabled with these 
settings:connection_control_min_connection_delay=1000 
connection_control_max_connection_delay=2000
The minimum and maximum delays need to be 
increased to 3000 and 5000, respectively. A command is executed:mysql> 
SET GLOBAL connection_control_min_connection_delay=3000;
What is the result? C)The minimum value increases to 3000 and the maximum value increases to 4000. [错误] 
A)Only the minimum connection value is increased to 3000. [错误] 
B)The minimum connection value is changed to 2000. [错误] 
D)An error is returned. [正确] 

解析

选择最佳答案。MySQL服务器实例已启用连接控制插件,并配置了以下参数:connection_control_min_connection_delay=1000
connection_control_max_connection_delay=2000现在需要将最小和最大延迟分别增加到3000和5000。执行了以下命令:
sqlSET GLOBAL connection_control_min_connection_delay=3000;结果是什么?选项:
A) 仅最小连接值增加到3000
B) 最小连接值被改为2000
C) 最小值增加到3000,最大值增加到4000
D) 返回一个错误
中文解析正确答案是D) 返回一个错误。解析:在MySQL连接控制插件中,connection_control_min_connection_delay(最小连接延迟)的值不能大于connection_control_max_connection_delay(最大连接延迟)的值。当前设置是最小1000,最大2000。当尝试将最小值设置为3000时,这会超过当前的最大值2000,因此MySQL会拒绝这个设置并返回错误。要完成题目要求的调整(最小3000,最大5000),必须先设置最大值为5000,然后再设置最小值为3000。

试题176:

How can mysqld_multi be configured to allow MySQL instances to use the same port number? 
D)The instances listen on different IP addresses. [正确] 
B)The instances use different user accounts unique to each instance. [错误] 
C)The instances use different socket names. [错误] 
A)The instances have appropriate net masks set. [错误] 

解析

如何配置mysqld_multi以使多个MySQL实例可以使用相同的端口号?选项:
D) 实例监听在不同的IP地址上 [正确]
B) 实例使用每个实例独有的不同用户账户 [错误]
C) 实例使用不同的套接字名称 [错误]
A) 实例设置了适当的网络掩码 [错误]正确答案是D) 实例监听在不同的IP地址上。解析:在TCP/IP网络中,一个端口号只能被一个服务实例在一个IP地址上使用。要让多个MySQL实例使用相同的端口号,必须让这些实例绑定到不同的IP地址上。这样每个实例都有自己的"IP:端口"组合,即使端口号相同,IP地址不同也不会冲突。

试题177:

Choose the best answer.MySQL is installed on a Linux server with this configuration:mysqld 
user=mysql datadir=/data/mysqlWhich method sets the default authentication to SHA-256 hashing 
for authenticating user account passwords? 
B)Add default_authentication_plugin=sha256_password in the configuration file. [正确] 
D)Set validate-user-plugins=caching_sha2_password in the configuration file. [错误] 
C)Add default_authentication_plugin=mysql_native_password in the configuration file. [错误] 
A)Define CREATE USER ' '@'%' IDENTIFIED WITH sha256_password in the MySQL instance. [错误]

解析

MySQL安装在Linux服务器上,配置如下:mysqld user=mysql datadir=/data/mysql哪种方法可以将用户账户密码的默认认证方式设置为SHA-256哈希?B) 在配置文件中添加 default_authentication_plugin=sha256_password [正确]
D) 在配置文件中设置 validate-user-plugins=caching_sha2_password [错误]
C) 在配置文件中添加 default_authentication_plugin=mysql_native_password [错误]
A) 在MySQL实例中定义 CREATE USER ' '@'%' IDENTIFIED WITH sha256_password [错误]正确答案是B) 在配置文件中添加 default_authentication_plugin=sha256_password。解析:要设置MySQL服务器默认使用SHA-256密码哈希认证,需要在配置文件中指定default_authentication_plugin=sha256_password。这个参数会确保新创建的用户默认使用SHA-256密码哈希方式认证。其他选项错误原因:D) 错误,validate-user-plugins参数用于验证用户插件,且caching_sha2_password是另一种不同的插件C) 错误,mysql_native_password是传统的MySQL密码认证方式,不是SHA-256A) 错误,创建空白用户不会改变系统默认认证方式

试题178:

Examine these two reports taken 100 seconds apart:GLOBAL STATUS 
1:Com_create_table=500005Com_drop_table=500003Com_flush=23Create_tmp_disk_tables=400000Create_tmp_tables=1200000Max_used_connections=92Open_files=5000Opened_files=5000Open_table_definitions=3000Open_tables=1024Opened_table_definitions=2369Opened 
_tables=3500000Threads_connected=62Threads_running=58Uptime=100000GLOBAL STATUS 
2:Com_create_table=500505Com_drop_table=500498Com_flush=31Create_tmp_disk_tables=400400Create_tmp_tables=1201200Max_used_connections=92Open_files=5000Opened_files=7505Open_table_definitions=3000Open_tables=1024Opened_table_definitions=2873Opened 
_tables=3503500Threads_connected=67Threads_running=64Uptime=100000Your MySQL system 
normally supports 50-75 concurrent connections.Which configuration change will improve 
performance? 
D)increase table_open_cache [正确] 
B)decrease open_files_limit [错误] 
A)increase max_connections [错误] 
C)decrease table_definition_cache [错误]

解析

分析两份间隔100秒的全局状态报告:GLOBAL STATUS 1:Com_create_table=500005
Com_drop_table=500003
Com_flush=23
Create_tmp_disk_tables=400000
Create_tmp_tables=1200000
Max_used_connections=92
Open_files=5000
Opened_files=5000
Open_table_definitions=3000
Open_tables=1024
Opened_table_definitions=2369
Opened_tables=3500000
Threads_connected=62
Threads_running=58
Uptime=100000GLOBAL STATUS 2:Com_create_table=500505
Com_drop_table=500498
Com_flush=31
Create_tmp_disk_tables=400400
Create_tmp_tables=1201200
Max_used_connections=92
Open_files=5000
Opened_files=7505
Open_table_definitions=3000
Open_tables=1024
Opened_table_definitions=2873
Opened_tables=3503500
Threads_connected=67
Threads_running=64
Uptime=100000您的MySQL系统通常支持50-75个并发连接。哪种配置更改会提高性能?选项:
D) 增加 table_open_cache [正确]
B) 减少 open_files_limit [错误]
A) 增加 max_connections [错误]
C) 减少 table_definition_cache [错误]
中文解析正确答案是D) 增加 table_open_cache。解析关键指标:Opened_tables 值很高(350万→350.35万,100秒内增加了3500次打开操作)Open_tables 保持在1024(这是table_open_cache的默认值)打开表定义的操作也很频繁(Opened_table_definitions从2369增加到2873)性能问题分析:高频率的表打开操作(Opened_tables)表明表缓存不足Open_tables稳定在1024说明缓存已满,无法缓存更多表当前table_open_cache设置(默认1024)不足以支持工作负载

试题179:

Choose the best answer.A colleague complains about slow response time on your website. Examine 
this query and output:(见下图)
What is the most likely cause for the high number of lock waits? 
图片地址: https://oss-emcsprod-public.modb.pro/image/exam/question_1640079828127.jpg D)Your table accesses wait for the operating system level flush. [错误] 
C)You use the MyISAM storage engine for most common tables. [正确] 
A)You use the InnoDB storage engine and statements wait while data is inserted. [错误] 
B)The Innodb Buffer pool is full. [错误]

图片.png

解析

"Table_locks_waited"值很高最可能的原因是什么?正确答案是C) 解析关键点:Table_locks_waited值高(17716)表明存在大量表级锁等待MyISAM存储引擎使用表级锁(table-level locking),在高并发下容易产生锁等待InnoDB使用行级锁(row-level locking),通常不会反映在Table_locks_waited统计中表锁等待率高(17716/(53148+17716)≈25%)表明锁竞争严重其他选项错误原因:D) 错误,操作系统刷新与表锁等待无直接关系A) 错误,InnoDB的锁等待不会体现在Table_locks_waited中B) 错误,缓冲池满会影响性能但不会导致表锁等待

试题180:

Choose the best answer.(题干见图片)What is the reason for SSL not being used?
A)It is connected via a UNIX socket. [正确] 
D)The root user must use ssl_fips_mode = ON. [错误] 
B)A current database is not selected. There is nothing to encrypt. [错误] 
C)The root user cannot use encryption. [错误]

图片.png

解析

选项:
A) 通过UNIX套接字连接 [正确]
D) root用户必须使用ssl_fips_mode = ON [错误]
B) 未选择当前数据库,没有需要加密的内容 [错误]
C) root用户不能使用加密 [错误]
中文解析正确答案是A) 通过UNIX套接字连接。解析关键点:连接信息明确显示是通过UNIX套接字(/var/lib/mysql/mysql.sock)建立的本地连接UNIX域套接字通信发生在操作系统内核内部,不经过网络栈,因此不需要SSL加密SSL/TLS是为网络通信设计的加密协议,不适用于本地套接字通信即使服务器配置了SSL参数,本地套接字连接也不会使用SSL其他选项错误原因:D) 错误,FIPS模式与SSL使用无关,只是加密标准B) 错误,SSL加密的是传输通道,与是否选择数据库无关C) 错误,root用户完全可以使用加密连接补充说明:
要使SSL生效,需要使用TCP/IP连接(如-h 127.0.0.1而不是localhost),因为localhost在MySQL中默认使用UNIX套接字连接。
http://www.xdnf.cn/news/1016947.html

相关文章:

  • 26-数据结构-线性表2
  • linux alignment fault对齐造成设备挂死问题定位梳理
  • Leetcode 2604. 吃掉所有谷子的最短时间
  • 线性回归原理推导与应用(九):逻辑回归多分类问题的原理与推导
  • 用户通知服务,轻松实现应用与用户的多场景交互
  • 嵌套滚动交互处理总结
  • FastChat 架构拆解:打造类 ChatGPT 私有化部署解决方案的基石
  • python实现鸟类识别系统实现方案
  • Java实现Pdf转Word
  • 打破语言壁垒!DHTMLX Gantt 与 Scheduler 文档正式上线中文等多语言版本!
  • 使用 PolarProxy+Proxifier 解密 TLS 流量
  • 北京大学肖臻老师《区块链技术与应用》公开课:08-BTC-比特币挖矿
  • MySQL索引原理
  • KDJ指标的运用
  • 商家如何利用Shopify插件进行AB测试和优化
  • MAC无法 ping 通github 系列主页
  • EFK架构的数据安全性
  • AI编程第一步:零基础用人工智能生成你的Hello World和计算器
  • SQL力扣
  • 【AI News | 20250613】每日AI进展
  • 使用若依框架新建模块后导入UI项目目录对应前端文件后报找不到文件错误处理
  • 【DVWA系列】——xss(Stored)——High详细教程
  • 高精度算法详解:从原理到加减乘除的完整实现
  • 【AI图像生成网站Golang】部署图像生成服务(阿里云ACK+GPU实例)
  • skynet源码学习-skynet_mq队列
  • 目标检测标注格式
  • 对象映射 C# 中 Mapster 和 AutoMapper 的比较
  • 无人机侦测与反制技术进展
  • 精益数据分析(101/126):SaaS商业模式优化与用户生命周期价值提升策略
  • React 第六十一节 Router 中 createMemoryRouter的使用详解及案例注意事项