Using Option Files for MySQL programs? Usage of Option Files

MySQLMySQLi Database

Let us understand how option files can be used with MySQL programs −

  • Most MySQL programs can read the startup options from option files, which is also known as the configuration files.

  • Option files provide an easy way to specify commonly used options so that they need not be entered on the command line every time the user runs a program.

  • To know whether a program reads option files or not, it can be invoked with the help of the −−help option.

  • For mysqld, the −−verbose and –help can be used.

  • If the program reads option files, the help message indicates the files that it needs to look for and which option groups it will recognize.

A MySQL program that is started with the −−no−defaults option reads no option files apart from the .mylogin.cnf. A server that is started with the persisted_globals_load system variable disabled doesn’t read mysqld−auto.cnf.

Option Files

Many option files are plain text files which are created using any text editor. The exceptions are discussed below −

  • The .mylogin.cnf file which contains login path options.

  • This is an encrypted file which is created by the mysql_config_editor utility.

  • A “login path” is an option group that allows only certain options: host, user, password, port and socket.

  • Client programs specify which login path to read from .mylogin.cnf with the help of the −−login−path option.

  • To specify an alternative login path file name, the MYSQL_TEST_LOGIN_FILE environment variable has to be set.

  • This variable is used by the mysql−test−run.pl testing utility, but is also recognized by mysql_config_editor and by MySQL clients like mysql, mysqladmin, and so forth.

  • The mysqld−auto.cnf file in the data directory is a JSON−format file that contains persisted system variable settings.

  • It is created by the server after execution of SET PERSIST or SET PERSIST_ONLY statements.

  • Management of mysqld−auto.cnf should be done by the server and not performed manually.

raja
Updated on 09-Mar-2021 13:41:08

Advertisements