mysqldump导出指定字符开头的库
You want to dump all databases with names that start with "db". Which command will achieve this?
A)mysqldump --include-tables=db.% --result-file=all_db_backup.sql
B)mysqldump --include-databases=db --result-file=all_db_backup.sql
C)mysqldump --include-databases=db% --result-file=all_db_backup.sql
D)mysqldump > all_db_backup.sql
1. 选项解析
A) --include-tables=db.%
错误:--include-tables 用于筛选表名,而非数据库名。
db.% 表示匹配表名以 db. 开头的表(如 db.users),与数据库无关。
B) --include-databases=db
错误:--include-databases=db 仅匹配名为 db 的单个数据库,无法匹配以 db 开头的其他数据库(如 db1、db_backup)。
C) --include-databases=db%
正确:% 是通配符,表示匹配以 db 开头的所有数据库(如 db1、db_backup)。
注意:实际 MySQL 8.0 中 mysqldump 不支持 --include-databases 参数,但题目假设其存在,因此按题意选择此选项。
D) mysqldump > all_db_backup.sql
错误:不带任何参数时,mysqldump 默认导出所有数据库(使用 --all-databases),无法按名称筛选。
2. 相关知识点总结
2.1 mysqldump 参数与功能
2.2 通配符与正则表达式
mysql -N -e "SHOW DATABASES LIKE 'db%'" | xargs mysqldump --databases > all_db_backup.sql
2.3 常见误区
Q2: 审计插件
Examine this parameter setting:
audit_log=FORCE_LOG_OERMAENT
What effect does this have on auditing?
A)It will force the load of the audit plugin even in case of errors at server start.
B)It causes the audit log to be created if it does not exist.
C)It prevents the audit plugin from being removed from the running server.
D)It prevents the audit log from being removed or rotated.
1. 选项解析
A) 强制加载审计插件(即使启动时报错)
错误:FORCE_LOG_PERMANENT 并非用于处理启动错误,而是防止插件被运行时卸载。
B) 自动创建不存在的审计日志文件
错误:日志文件的创建由 audit_log_file 参数路径决定,与 FORCE_LOG_PERMANENT 无关。
C) 防止运行时移除插件
正确:FORCE_LOG_PERMANENT 的核心功能是确保插件在服务器运行期间保持激活状态,禁止动态卸载。
D) 阻止审计日志删除或轮转
错误:日志轮转由 audit_log_rotate_on_size 控制,删除或轮转操作不受此参数限制
2. 审计插件的管理
2.1 插件加载方式
INSTALL PLUGIN audit_log SONAME 'audit_log.so'; -- 动态安装
UNINSTALL PLUGIN audit_log; -- 动态卸载(受 FORCE_LOG_PERMANENT 限制)
在 my.cnf 中配置 plugin-load=audit_log.so 和 audit_log=FORCE_LOG_PERMANENT,确保插件随服务启动自动加载且不可卸载。
2.2 审计日志的运维操作
通过 audit_log_rotate_on_size 设置自动轮转阈值(如 4MB),或手动执行轮转命令。
使用 audit_log_encryption_password_set() 函数设置加密密码,确保日志文件安全性。
Q3: MySQL用户密码加密插件
You recently upgraded your MYSQL installation to MYSQL8.0 Examine this client error:
Error 2059 (HY000):authentication plugin ‘caching_sha2_password’ cannot be
Loaded: /usr/local/mysql/libplugin/caching_sha2_password.so: cannot open shared object file: No such or directory
Which option will allow this client to connect to MYSQL Server?
A)[mysqld] default_authentication_plugin=sha256_password
B)[mysqld] default_authentication_plugin=caching_sha2_password
C)ALTER USER user IDENTIFIED WITH mysql_native_password BY ‘password’;
D)ALTER USER user IDENTIFIED WITH caching_sha2_password
E)ALTER USER user IDENTIFIED WITH sha256_password
F)[mysqld] default_authentication_plugin=mysql_native_password
1. 选项解析
A)default_authentication_plugin=sha256_password
错误:sha256_password 同样需要客户端支持对应插件,且未解决当前缺失文件的根本问题。
B)default_authentication_plugin=caching_sha2_password
错误:会加剧问题,强制使用缺失的插件会导致更多连接失败。
C)修改用户认证为 mysql_native_password
正确:mysql_native_password 是 MySQL 5.7 及更早版本的默认插件,兼容性广,无需额外插件文件。直接通过 SQL 修改用户认证方式可绕过插件缺失问题。
D/E)强制使用 caching_sha2_password 或 sha256_password
错误:客户端缺少插件文件,无法加载。
F)default_authentication_plugin=mysql_native_password
错误:辅助作用,修改服务器默认认证插件为 mysql_native_password 可避免新用户使用 caching_sha2_password,但需重启服务且不影响已存在的用户。
Q4 :SDI(Serialized Dictionary Information)的存储机制
You made some table definition changes to a schema in your MySQL Server.
Which two statements reflect how MySQL Server handles the table definition changes?
A)MySQL keeps InnoDB metadata changes in .sdi files in datadir.
B)MySQL Server stores a copy of the serialized data in the InnoDB user tablespace.
C)MySQL writes SDI to the binary log for distributed backups.
D)MySQL implicitly executes FLUSH TABLES and stores a snapshot backup of the metadata.
E)The metadata is serialized in JSON format in Serialized Dictionary Information (SDI).
1. 选项解析
1.1 SDI(Serialized Dictionary Information)的存储机制
1.2 错误选项分析
2. SDI 相关知识总结
2.1 SDI 的作用与结构
2.2 SDI 的更新与兼容性
2.3 实际应用场景
当数据字典损坏时,使用 ibd2sdi 工具从 .ibd 文件中提取 SDI 的 JSON 数据,重建表结构。示例命令如下:
ibd2sdi table.ibd > table_metadata.json
解析 SDI 可快速获取表的元数据历史版本,用于审计或对比不同时间点的表结构差异。
Q5: MySQL Installer
Which two statements are true about MySQL Installer?
A)It provides a uniform installation wizard across multiple platforms.
B)Manual download of separate product packages is required before installing them through MySQL Installer.
C)It provides only GUI-driven, interactive installations.
D)It performs product upgrades.
E)It installs most Oracle MySQL products.
1. 选项解析
1.1 MySQL Installer 的核心功能(正确选项)
MySQL Installer 支持对已安装的 MySQL 产品进行升级。例如,用户可以通过其界面或命令行工具自动检测并升级 MySQL 服务器版本及相关组件(如 Workbench、Connectors 等)。升级操作包括下载最新版本、替换旧版本文件并自动完成配置调整。
1.2 错误选项分析
错误。虽然 MySQL Installer 支持 Windows、Linux 和 macOS 等多个平台,但其安装向导在不同操作系统上的实现方式存在差异。例如,Windows 版本提供图形化界面(GUI),而 Linux 和 macOS 更多依赖命令行操作,因此“统一向导”的表述不准确。
错误。MySQL Installer 通过在线目录自动下载所需的安装包(如选择网络安装模式),用户无需提前手动下载。仅当选择离线安装时才需预先准备完整安装包。
错误。MySQL Installer 提供了命令行工具 MySQLInstallerConsole.exe,支持通过脚本或命令进行非交互式安装和配置,适用于自动化部署场景。
2. 相关知识小结
2.1 MySQL Installer 的版本与使用场景
2.1.1 社区版(CE)与企业版(EE)的区别
2.1.2 典型应用场景
2.2 操作建议
启动 MySQL Installer,点击 Catalog 更新产品目录。
选择需要升级的组件(如 MySQL Server),点击 Upgrade 执行自动升级流程。
MySQLInstallerConsole.exe install server --version=8.0.32 --port=3307 --password=your_password
此命令会以非交互模式安装 MySQL 8.0.32 并设置端口和密码