Question 313 of 511
System SecurityhardMultiple ChoiceObjective-mapped

Quick Answer

The answer is to edit the MySQL configuration file (my.cnf) and set bind-address = 127.0.0.1, then restart the service. This is correct because the bind-address directive controls which network interfaces the MySQL server listens on; setting it to 127.0.0.1 restricts listening to the loopback interface only, preventing any remote network connections while still allowing local applications like Apache and PHP to connect via the local socket or TCP to 127.0.0.1. On the LPIC-2 exam, this scenario tests your understanding of service hardening and network socket configuration under Objective 207.2, where a common trap is to confuse bind-address with skip-networking or to mistakenly change firewall rules instead of the MySQL config. The key insight is that the application and database are co-located, so blocking remote access with bind-address is the minimal, non-breaking change. Memory tip: think "loopback locks local" — 127.0.0.1 keeps MySQL local, not global.

LPIC-2 System Security Practice Question

This LPIC-2 practice question tests your understanding of system security. This is a configuration task: choose the command set that satisfies every stated requirement. Small differences — like 'secret' vs 'password' or 'transport input ssh' vs 'all' — change whether the answer is correct. After answering, compare your reasoning against the explanation and wrong-answer breakdown below. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.

A company runs a web application on a Linux server that uses Apache, MySQL, and PHP. The application stores sensitive user data in a MySQL database. The security team has detected that the MySQL service is listening on port 3306 on all interfaces (0.0.0.0). The application and database are on the same server, so there is no need for remote database access. The administrator must secure the MySQL service without breaking the application. Which of the following is the most appropriate course of action?

Question 1hardmultiple choice
Full question →

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

Edit the MySQL configuration file (my.cnf) and set bind-address = 127.0.0.1, then restart the MySQL service.

Setting bind-address = 127.0.0.1 in the MySQL configuration file (my.cnf) instructs the MySQL server to listen only on the loopback interface, which prevents remote connections while still allowing local applications (Apache/PHP) to connect via the local socket or TCP to 127.0.0.1. This directly addresses the security concern of exposing the database on all interfaces without breaking the application, as the application and database reside on the same server.

Key principle: Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Edit the MySQL configuration file (my.cnf) and set bind-address = 127.0.0.1, then restart the MySQL service.

    Why this is correct

    This restricts MySQL to listen only on localhost, preventing remote connections.

    Related concept

    Read the scenario before looking for a memorised answer.

  • Change the MySQL default port to a non-standard port to avoid automated scans.

    Why it's wrong here

    Changing the port does not prevent direct connection attempts.

  • Disable the MySQL network entirely by commenting out the 'skip-networking' directive in my.cnf.

    Why it's wrong here

    Disabling networking would force the application to use Unix sockets, which may require reconfiguration of the PHP database connection.

  • Use iptables to add a rule dropping incoming packets to port 3306 from all IPs except 127.0.0.1.

    Why it's wrong here

    This is more complex and still exposes the service to local network if misconfigured.

Common exam traps

Common exam trap: answer the scenario, not the keyword

The trap here is that candidates may confuse 'skip-networking' with disabling networking (option C) or think that changing the port (option B) is sufficient security, when in fact the core issue is the binding to all interfaces, which is directly solved by the bind-address directive.

Detailed technical explanation

How to think about this question

The bind-address directive in MySQL's my.cnf controls which IP address the server socket binds to; setting it to 127.0.0.1 causes MySQL to listen only on the loopback interface (lo), effectively making it unreachable from any external network. Under the hood, MySQL uses the TCP/IP stack, and binding to 0.0.0.0 (the default) listens on all available interfaces, while binding to 127.0.0.1 restricts it to the local host. In a real-world scenario, if the application uses a Unix socket (e.g., /var/run/mysqld/mysqld.sock) instead of TCP, the bind-address change has no effect on connectivity, but many PHP configurations default to TCP even for localhost, so this change is safe and effective.

KKey Concepts to Remember

  • Read the scenario before looking for a memorised answer.
  • Find the constraint that changes the correct option.
  • Eliminate answers that are true in general but not in this case.

TExam Day Tips

  • Watch for words such as best, first, most likely and least administrative effort.
  • Review why wrong options are wrong, not only why the correct option is correct.

Key takeaway

Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

Real-world example

How this comes up in practice

A practitioner preparing for the LPIC-2 exam encounters this exact type of scenario on the job. The correct answer here is not the most general option — it is the best answer for the specific constraint described. Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option. Real exam questions reward reading the full scenario before eliminating options, because the constraint defines which answer fits.

What to study next

Got this wrong? Here's your next step.

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

Related practice questions

Related LPIC-2 practice-question pages

Use these pages to review the topic behind this question. This is how one missed question becomes focused revision.

Practice this exam

Start a free LPIC-2 practice session

Short sessions build daily habit. Longer sessions build exam-day stamina. Try a timed session to simulate real conditions.

FAQ

Questions learners often ask

What does this LPIC-2 question test?

System Security — This question tests System Security — Read the scenario before looking for a memorised answer..

What is the correct answer to this question?

The correct answer is: Edit the MySQL configuration file (my.cnf) and set bind-address = 127.0.0.1, then restart the MySQL service. — Setting bind-address = 127.0.0.1 in the MySQL configuration file (my.cnf) instructs the MySQL server to listen only on the loopback interface, which prevents remote connections while still allowing local applications (Apache/PHP) to connect via the local socket or TCP to 127.0.0.1. This directly addresses the security concern of exposing the database on all interfaces without breaking the application, as the application and database reside on the same server.

What should I do if I get this LPIC-2 question wrong?

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

What is the key concept behind this question?

Read the scenario before looking for a memorised answer.

About these practice questions

Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Last reviewed: Jun 11, 2026

Question Discussion

Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.

Loading comments…

Sign in to join the discussion.

This LPIC-2 practice question is part of Courseiva's free LPI certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the LPIC-2 exam.