暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

MySQL 8.0 OCP 连接参数配置必考题

409

💡 今日题目解析
一道MySQL认证考试高频题:

如何配置Linux客户端连接远程Windows MySQL服务器(端口3309)的用户、主机和数据库参数?

考试题型:多选题(需选择4个正确选项)
题目原文
Choose four.

You must store connection parameters for connecting a Linux-based MySQL client to a remote Windows-based MySQL server listening on port 3309. Which four methods can be used to configure user, host, and database parameters?

选项分析
✅ C) Configure ~/.my.cnf

✅ E) Execute the command in a BASH script
✅ B) Execute mysql_config_editor
 to configure the user connection

✅ F) Configure environment variables
❌ D) Execute the mysqladmin
 command
❌ H) Use the usermod
 program
❌ G) Define a UNIX socket
❌ A) Embed login information into the SSH tunnel definition
❌ I) Configure ~/.ssh/config
 for public key authentication

答案补充说明
To specify the TCP/IP port number (e.g., 3309), use the environment variable MYSQL_TCP_PORT
.


题目解读

1. 核心技能点

目标:配置MySQL客户端连接参数(用户、主机、数据库、端口)。
场景:Linux客户端连接远程Windows服务器(端口3309)。

2. 正确选项解析

选项原理与示例
C) ~/.my.cnf
用户级配置文件:
[client]
段中设置user=root
host=192.168.1.100
port=3309
E) BASH脚本
直接传参:
mysql -u root -h 192.168.1.100 -P 3309 -D mydb
B) mysql_config_editor
加密存储凭据:
mysql_config_editor set --login-path=dev --host=192.168.1.100 --user=root --port=3309
F) 环境变量
设置变量:
export MYSQL_TCP_PORT=3309

export MYSQL_USER=root

3. 错误选项排除原因

选项错误原因
D) mysqladmin
用于管理MySQL服务(如关闭服务),无法配置连接参数
H) usermod
修改系统用户账户,与MySQL客户端无关
G) UNIX Socket
仅适用于本地Unix/Linux服务器,远程需TCP/IP
A/I) SSH/公钥配置
属于网络层安全,不存储MySQL连接参数

👇 试试用环境变量连接:

export MYSQL_TCP_PORT=3309
mysql -h 192.168.1.100 -u root -p

学会了吗?评论区聊聊你的解题思路!


往期文章:

MySQL 30 周年庆!MySQL 8.4 认证免费考!

MySQL 8.0 OCP 1Z0-908 考试题解析1

MySQL 8.0 OCP 1Z0-908 考试题解析2

MySQL 8.0 OCP 1Z0-908 考试题解析3


文章转载自数据库运维之道,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论