MySQL 8.0 OCP 英文题库解析(二十三)[已完结]

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

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

微信图片_20250507171214.png

本期公布试题211~215

试题211:

Examine this configuration:You have a corporate private network, which uses its own Certificate 
Authority (CA) using an industry standard 2048-bit RSA key length.All MySQL Server and client 
certificates are signed using the central corporate CA.All clients are known, controlled,,and exist 
only on the private LAN.The private network uses its own private authoritative DNS.The private 
network also uses other nominal enterprise services.An end-to-end encrypted connection for a 
MySQL client to MySQL server has been established on this LAN.How does the MySQL Servers' self 
signed certificate compare to one that would be signed by a known public, third party trusted 
Certificate Authority? 
A)The self-signed certificate is equally secure and equally trusted. [错误] 
D)The self-signed certificate is equally secure and less trusted. [错误] 
E)The self -signed certificate is more secure and equally trusted. [错误] 
C)The self-signed certificate is less secure and equally trusted. [错误] 
B)The self-signed certificate is more secure and less trusted. [错误] 
F)The self-signed certificate is less secure and less trusted [正确]

解析

    你有一个企业私有网络,使用自有的证书颁发机构(CA),采用行业标准的 2048 位 RSA 密钥长度。
    所有 MySQL 服务器和客户端证书均由该企业 CA 签发。
    所有客户端均为已知、受控设备,且仅存在于私有 LAN 内。
    私有网络使用自有的权威 DNS。
    私有网络还运行其他标准企业服务。
    在该 LAN 上,MySQL 客户端与服务器之间已建立端到端加密连接。

✅ F) 自签名证书安全性较低且更不受信任。

    正确:
        安全性较低:虽然题目中加密强度相同,但自签名证书缺乏公共 CA 的审计和吊销机制(如 CRL、OCSP),实际管理风险更高。
        更不受信任:仅限内部使用,无法被外部系统默认信任。

❌ 其他选项错误原因:

    A/D/E:声称自签名证书“同样安全”或“更安全”不完全正确(公共 CA 有更严格的生命周期管理)。
    B/C:未同时指出“安全性较低”和“更不受信任”两个关键点。

试题212:

Choose the best answer.Examine these statements and output:mysql> GRANT PROXY ON 
accounting@localhost TO ' '@'%' ; mysql> SELECT USER(), CURRENT_USER(), @@proxy_user;(见下
图)Which statement is true? 

B)The user is authorized as the rsmith@localhost user. [错误] 
E)The user is authorized as the accounting@localhost user. [正确] 
C)The user is authenticated as the anonymous proxy user ' '@'%'. [错误] 
A)The user failed to define a username and the connecting username defaulted to ' '@'%'. [错误] 
D)The user is logged in with --user=accounting as an option. [错误]

图片.png

解析

    虽然用户以 rsmith@localhost 身份登录,但通过 GRANT PROXY 授权,其权限已代理给 accounting@localhost(由 CURRENT_USER() 体现)。

    因此,当前会话的实际权限是 accounting@localhost,选项 E 正确。

    B) 错误:rsmith@localhost 是登录身份,但权限已代理给 accounting。

    C) 错误:' '@'%' 是代理用户,但权限最终归属于 accounting(CURRENT_USER() 的优先级更高)。

    A) 错误:' '@'%' 是显式定义的代理用户,非默认行为。

    D) 错误:无证据表明用户通过 --user=accounting 登录(实际登录用户是 rsmith)。

试题213:

MySQL server in a file on a local file system.Which is the best way to encrypt the file? 
C)Use mysql_config_editor to create an encrypted file. [正确] 
B)Use a text editor to create a new defaults file and encrypt it from Linux prompt. [错误] 
D)Use the AES_ENCRYPT() MySQL function on the option file. [错误] 
A)Use mysql_secure_installation to encrypt stored login credentials. [错误]

解析

将客户端连接 MySQL 服务器的用户名和密码存储在本地的某个文件中。加密该文件的最佳方式是什么?

选项:
A) 使用 mysql_secure_installation 加密存储的登录凭据。 [错误]
B) 使用文本编辑器创建新的 defaults 文件,并在 Linux 终端中加密它。 [错误]
C) 使用 mysql_config_editor 创建一个加密文件。 [正确]
D) 使用 MySQL 的 AES_ENCRYPT() 函数加密选项文件。 [错误]

mysql_config_editor(选项 C)
    作用:MySQL 官方工具,用于生成加密的 .mylogin.cnf 文件(存储用户名、密码等连接信息)。
    加密方式:使用对称加密(如 AES),密钥由用户本地系统保护。

    优点:
        无需明文存储密码。
        客户端工具(如 mysql、mysqldump)可自动读取该文件,无需手动输入密码。
    mysql_config_editor set --login-path=client --host=localhost --user=myuser --password
    (输入密码后,信息会加密保存到 ~/.mylogin.cnf)

其他选项的局限性:
    A) mysql_secure_installation:
        用于初始化 MySQL 安全设置(如删除匿名用户、设置 root 密码等),不涉及凭据加密存储。
    B) 手动加密 defaults 文件:
        需依赖外部工具(如 gpg),且解密后仍需处理明文密码,操作复杂且安全性低。
    D) AES_ENCRYPT():
        是 MySQL 服务端的加密函数,不适用于本地文件加密,且需额外管理密钥。

试题214:

You recently upgraded your MYSQL installation to MYSQL8.0 Examine this client error:Error 2059 
(HY000):authentication plugin ‘caching_sha2_password’ cannot 
beLoaded:/usr/local/mysql/libplugin/caching_sha2_password.so:cannot open shared object file:No 
such or directoryWhich option will allow this client to connect to MYSQL Server? 
B)mysqld default_authentication_plugin=caching_sha2_password [错误] 
C)ALTER USER user IDENTIFIED WITH mysql_native_password BY ‘password’; [正确] 
A)mysqld default_authentication_plugin=sha256_password [错误] 
F)mysqld default_authentication_plugin=mysql_native_password [错误] 
D)ALTER USER user IDENTIFIED WITH caching_sha2_password [错误] 
E)ALTER USER user IDENTIFIED WITH sha256_password  [错误]


解析

    MySQL 8.0 的默认认证插件变更:
        MySQL 8.0 默认使用 caching_sha2_password 插件,但某些旧版客户端或系统可能缺少对应的动态库文件(如 caching_sha2_password.so)。
        错误信息表明:客户端无法加载该插件,导致连接失败。

    解决方案的核心:
        将用户的认证方式改为旧版兼容的 mysql_native_password(所有客户端均支持)。

正确选项(C):

✅ ALTER USER user IDENTIFIED WITH mysql_native_password BY 'password';
    作用:将指定用户的认证插件改为 mysql_native_password,并更新密码。
    为什么正确?
        mysql_native_password 是 MySQL 5.7 及更早版本的默认插件,无需额外动态库文件。
        修改后,客户端可正常连接,无需升级或安装插件。

试题215:

Choose the best answer.Which condition is true about the use of the hash join algorithm? 
D)The smallest of the tables in the join must fit in memory as set by join_buffer_size. [错误] 
B)No index can be used for the join. [正确] 
A)At least one of the tables in the join must have a hash index. [错误] 
C)The query must access no more than two tables. [错误]

解析

    B) 正确:哈希连接通常在不使用索引的情况下效果最好,因为它会为连接键构建内存中的哈希表。如果已经存在索引(如B树索引),优化器可能会选择其他连接方式(如嵌套循环连接)。
    A) 错误:哈希连接不需要表预先存在哈希索引。它是执行时动态构建的临时哈希表,与表的存储结构无关。
    C) 错误:哈希连接可以用于多表连接(不止两个表),只要优化器认为合适。
    D) 错误:虽然哈希连接需要内存,但现代实现(如MySQL 8.0+)支持"grace hash join",当内存不足时会将数据分片到磁盘处理,不要求整个小表必须放入内存。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值