
💡 今日题目解析
一道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=3309export MYSQL_USER=root |
3. 错误选项排除原因
| 选项 | 错误原因 |
|---|---|
D) mysqladmin | |
H) usermod | |
| G) UNIX Socket | |
| A/I) SSH/公钥配置 |
👇 试试用环境变量连接:
export MYSQL_TCP_PORT=3309
mysql -h 192.168.1.100 -u root -p
学会了吗?评论区聊聊你的解题思路!




