nerdexam
Oracle

1Z0-888 · Question #90

To query two system variables, you execute this statement and get the results shown: mysql> SELECT @@autocommit, @@max_connections; +--------------+-------------------+ | @@autocommit |…

The correct answer is D. max_connections must be set at server start in an options file. Note: The stated correct answer (D) appears to be factually incorrect for modern MySQL - this may be a flawed exam question. Here's the accurate explanation: max_connections is actually a dynamic, global-only variable in MySQL. The statement SET @@max_connections=200 fails…

Installation and Configuration

Question

To query two system variables, you execute this statement and get the results shown: mysql> SELECT @@autocommit, @@max_connections; +--------------+-------------------+ | @@autocommit | @@max_connections | +--------------+-------------------+ | 1 | 151 | +--------------+-------------------+ 1 row in set (0.00 sec) When you execute the following two statements, only the first one succeeds: SET @@autocommit=0; SET @@max_connections=200; Why does the second statement fail?

Options

  • Amax_connections is a read-only variable that cannot be set dynamically.
  • Bmax_connections must be set globally instead of locally.
  • Cmax_connections is a derived variable that can only be set indirectly.
  • Dmax_connections must be set at server start in an options file.

How the community answered

(66 responses)
  • A
    14% (9)
  • B
    8% (5)
  • C
    3% (2)
  • D
    76% (50)

Explanation

Note: The stated correct answer (D) appears to be factually incorrect for modern MySQL - this may be a flawed exam question. Here's the accurate explanation:

max_connections is actually a dynamic, global-only variable in MySQL. The statement SET @@max_connections=200 fails because the @@variable syntax without a scope qualifier attempts a session-level assignment, but max_connections has no session scope. The correct syntax is SET GLOBAL max_connections = 200 or equivalently SET @@global.max_connections = 200.

Why B is the most technically accurate answer: Using SET @@autocommit=0 succeeds because autocommit has both session and global scope. Using SET @@max_connections=200 fails because MySQL interprets unqualified @@variable as session scope for settable variables, and max_connections is global-only - exactly what B describes.

Why D is misleading: MySQL has supported setting max_connections dynamically at runtime since at least MySQL 5.1. It does not require a server restart or options file.

Why A and C are wrong: max_connections is neither read-only nor derived - it is fully settable at runtime.

Memory tip: Variables with no session equivalent (server-wide settings like connection limits, buffer pool size) require SET GLOBAL. If you get "should be set with SET GLOBAL," you're setting a global-only variable at session scope.

If this is an official certification question, the intended answer is D - but challenge it, because B is what MySQL actually enforces.

Topics

#system variables#dynamic configuration#static variables#MySQL configuration

Community Discussion

No community discussion yet for this question.

Full 1Z0-888 Practice