Hi,
I wan to know where the MySQL variables stored? when I execute the

show variables; 
show status;

I see many more variables, so I want to know the place they are stored in? and the file name too?

Dani AI

Generated

Short answer: the values you see with the queries you ran are the server's runtime state — not a single on-disk list. Those values come from several places (built-in defaults, configuration files read at startup, command-line/service startup options, environment or package defaults, and any runtime changes made after the server started). observed many variables; correctly pointed toward configuration files as one of the sources, but the final value you see is the result of the server applying all sources in a defined precedence.

Typical precedence (highest overrides lower):

  • command-line / service startup options
  • configuration files read in order (system-wide, package-specific, per-instance, user)
  • compiled defaults built into the server binary
  • runtime changes applied with SET (these live in memory until the next restart unless persisted)

Practical checks to locate the actual file(s) and startup options used by your server:

  • Inspect the running process to see the exact command line used by the server:
    ps aux | grep mysqld
  • Ask the server binary which files it would read (run on the server host; may need the full path to the mysqld binary):
    mysqld --verbose --help | sed -n '1,120p'
  • Check service/unit files (systemd) or init scripts for explicit --defaults-file or --defaults-extra-file flags.

Troubleshooting tips: search all candidate directories for duplicate settings (the last one read wins), edit the section that applies to the server component (e.g., the [mysqld] section), and back up any config before changing it. Remember that many variables can be changed at runtime but will revert on restart unless you also make the change in the configuration the server actually reads. If changes don't take effect, confirm you edited the same file the server is using and that you restarted the service (or applied a supported dynamic change).

Recommended Answers

All 3 Replies

Variables are defined in option file.

Can you tell the exact name of the file, because I can not find such file ...I need the file which keep the variable like variable auto_increment_increment and so on ...

On windows my.ini and on Linux my.cnf

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.