Table of Contents
You can specify options for mysqld using any of the methods described in Program Options. However, in most cases it is desirable to make sure the server uses the same options each time it runs, so you normally specify options for it by listing them in option files. See Option files.
mysqld reads options from the mysqld and server groups. mysqld_safe reads options from the mysqld, server, mysqld_safe and safe_mysqld groups. mysql.server reads options from the mysqld and mysql.server groups. An embedded MySQL server usually reads options from the server, embedded and xxxxx_SERVER, where xxxxx is the name of the application.
mysqld accepts a lot of command-line options. For a list, execute mysqld --help. Before MySQL 4.1.1, --help prints the full help message. As of 4.1.1, it prints a brief message; to see the full list, use mysqld --help --verbose.
The following list shows some of the most common server options. Options used for replication are listed in a separate section, see Replication Options.
--ansi | Use SQL-99 syntax instead of MySQL syntax. See ANSI mode. | |||||||||||
--basedir=path, -b path | Path to installation directory. All paths are usually resolved relative to this. | |||||||||||
--big-tables | Allow big result sets by saving all temporary sets on file. This option prevents most ``table full'' errors, but also slows down queries for which in-memory tables would suffice. Since Version 3.23.2, MySQL is able to handle large result sets automatically by using memory for small temporary tables and switching to disk tables where necessary. | |||||||||||
--bind-address=IP | IP address to bind to. | |||||||||||
--console | Write the error log messages to stderr/stdout even if --log-error is specified. On Windows, mysqld will not close the console screen if this option is used. | |||||||||||
--character-sets-dir=path | Directory where character sets are. See Character sets. | |||||||||||
--chroot=path | Put the mysqld server in a closed environment during startup by using the chroot() system call. This is a recommended security measure since MySQL 4.0. (MySQL 3.23 is not able to provide a chroot() jail that is 100% closed.) Use of this option somewhat limits LOAD DATA INFILE and SELECT ... INTO OUTFILE, though. | |||||||||||
--core-file | Write a core file if mysqld dies. For some systems you must also specify --core-file-size to mysqld_safe. See mysqld_safe. Note that on some systems, such as Solaris, you will not get a core file if you are also using the --user option. | |||||||||||
--datadir=path, -h path | Path to the data directory. | |||||||||||
--debug[=...] | If MySQL is configured with --with-debug, you can use this option to get a trace file of what mysqld is doing. See Making trace files. | |||||||||||
--default-character-set=charset | Set the default character set. See Character sets. | |||||||||||
--default-table-type=type | Set the default table type for tables. See Table types. | |||||||||||
--delay-key-write[= OFF | ON | ALL] | How the DELAYED KEYS option should be used. Delayed key writing causes key buffers not to be flushed between writes for MyISAM tables. OFF disables delayed key writes. ON enables delayed key writes for those tables that were created with the DELAYED KEYS option. ALL delays key writes for all MyISAM tables. Available as of MySQL 4.0.3. See Server parameters. | |||||||||||
--delay-key-write-for-all-tables | Old form of --delay-key-write=ALL; may be used prior to MySQL 4.0.3 when --delay-key-write became available. | |||||||||||
--des-key-file=filename | Read the default keys used by DES_ENCRYPT() and DES_DECRYPT() from this file. | |||||||||||
--enable-external-locking (was --enable-locking) | Enable system locking. Note that if you use this option on a system on which lockd does not fully work (as on Linux), you will easily get mysqld to deadlock. | |||||||||||
--enable-named-pipe | Enable support for named pipes (only on Windows NT, 2000, XP). | |||||||||||
--exit-info, -T | This is a bit mask of different flags you can use for debugging the mysqld server. Do not use this option unless you know exactly what it does! | |||||||||||
--flush | Flush all changes to disk after each SQL statement. Normally MySQL only does a write of all changes to disk after each SQL statement and lets the operating system handle the syncing to disk. See Crashing. | |||||||||||
--help, -? | Display a short help message and exit. To see a longer message, use both the --verbose and --help options. (Prior to MySQL 4.1, --help always displays the longer message.) | |||||||||||
--init-file=file | Read SQL statements from this file at startup. | |||||||||||
--language=lang_name, -L lang_name | Client error messages in given language. lang_name may be given as the language name or the as the full pathname to the directory where the language files are installed. See Languages. | |||||||||||
--log[=file], -l [file] | Log connections and queries to this file. See Query log. If you don't specify a file name, MySQL will use hostname.log as filename. | |||||||||||
--log-bin=[file] | Log all queries that change data to this file. Used for backup and replication. See Binary log. If you don't specify a file name, MySQL will use hostname-bin as filename. | |||||||||||
--log-bin-index[=file] | Index file for binary log file names. See Binary log. If you don't specify file name, MySQL will use hostname-bin.index as filename. | |||||||||||
--log-error[=file] | Log errors and startup messages to this file. See Error log. If you don't specify file name, MySQL will use hostname.err as filename. | |||||||||||
--log-isam[=file] | Log all ISAM/MyISAM changes to this file (only used when debugging ISAM/MyISAM). | |||||||||||
--log-long-format | Log some extra information to the log files (update log, binary update log, and slow queries log, whatever log has been activated). For example, username and timestamp are logged for queries. If you are using --log-slow-queries and --log-long-format, then queries that are not using indexes also are logged to the slow query log. Note that --log-long-format is deprecated as of MySQL version 4.1, when --log-short-format was introduced (the long log format is the default setting since version 4.1). Also note that starting with MySQL 4.1 the --log-queries-not-using-indexes option is available for the purpose of logging queries that do not use indexes to the slow queries log. | |||||||||||
--log-queries-not-using-indexes | If you are using this option with --log-slow-queries, then also queries that are not using indexes are logged to the slow query log. This option is available as of MySQL 4.1. See Slow query log. | |||||||||||
--log-short-format | Log less information to the log files (update log, binary update log, and slow queries log, whatever log has been activated). For example, username and timestamp are not logged for queries. This options was introduced in MySQL 4.1. | |||||||||||
--log-slow-queries[=file] | Log all queries that have taken more than long_query_time seconds to execute to file. Note that the default for the amount of information logged has changed in MySQL 4.1. See the --log-long-format and --log-long-format options for details. See Slow query log. | |||||||||||
--log-update[=file] | Log updates to file.# where # is a unique number if not given. See Update log. The update log is deprecated and is removed in MySQL 5.0.0; you should use the binary log instead (--log-bin). See Binary log. Starting from version 5.0.0, using --log-update will just turn on the binlog instead (see News-5.0.0). | |||||||||||
--log-warnings, -W | Print out warnings like Aborted connection... to the .err file. Enabling this option is recommended, for example, if you use replication (you will get more information about what is happening, such as messages about network failures and reconnections). See Communication errors. This option used to be called --warnings. | |||||||||||
--low-priority-updates | Table-modifying operations (INSERT/DELETE/UPDATE) will have lower priority than selects. It can also be done via {INSERT | REPLACE | UPDATE | DELETE} LOW_PRIORITY ... to lower the priority of only one query, or by SET LOW_PRIORITY_UPDATES=1 to change the priority in one thread. See Table locking. | |||||||||||
--memlock | Lock the mysqld process in memory. This works on systems such as Solaris that support the mlockall() system call. This may help if you have a problem where the operating system is causing mysqld to swap on disk. Note that use of this option requires that you run the server as root, which is normally not a good idea for security reasons. | |||||||||||
--myisam-recover [=option[,option...]]] | Option is any combination of DEFAULT, BACKUP, FORCE or QUICK. You can also set this explicitly to "" if you want to disable this option. If this option is used, mysqld will on open check if the table is marked as crashed or if the table wasn't closed properly. (The last option only works if you are running with --skip-external-locking.) If this is the case mysqld will run check on the table. If the table was corrupted, mysqld will attempt to repair it. The following options affects how the repair works. |
| ||||||||||
--new |
From version 4.0.12, the --new option can be used to make the server
behave as 4.1 in certain respects, easing a 4.0 to 4.1 upgrade:
| |||||||||||
--pid-file=path | Path to pid file used by mysqld_safe. | |||||||||||
--port=num, -P num | Port number to listen for TCP/IP connections. | |||||||||||
--old-protocol, -o | Use the 3.20 protocol for compatibility with some very old clients. See Upgrading-from-3.20. | |||||||||||
--one-thread | Only use one thread (for debugging under Linux). This option is available only if the server is built with debugging enabled. See Debugging server. | |||||||||||
--open-files-limit= | To change the number of file descriptors available to mysqld. If this is not set or set to 0, then mysqld will use this value to reserve file descriptors to use with setrlimit(). If this value is 0 then mysqld will reserve max_connections*5 or max_connections + table_cache*2 (whichever is larger) number of files. You should try increasing this if mysqld gives you the error 'Too many open files'. | |||||||||||
--set-variable=name=value, -O value | Give a variable a value. --help lists variables. You can find a full description for all variables in the SHOW VARIABLES section in this manual. See SHOW VARIABLES. The tuning server parameters section includes information of how to optimize these. Please note that --set-variable=name=value and -O name=value syntax is deprecated as of MySQL 4.0. Use --name=value instead. See Server parameters. In MySQL 4.0.2 one can set a variable directly with --variable-name=option and set-variable is no longer needed in option files. If you want to restrict the maximum value a startup option can be set to with SET, you can define this by using the --maximum-variable-name command line option. See SET OPTION. Note that when setting a variable to a value, MySQL may automatically correct it to stay within a given range and also adjusts the value a little to fix for the used algorithm. | |||||||||||
--safe-mode | Skip some optimize stages. | |||||||||||
--safe-show-database | With this option, the SHOW DATABASES statement returns only those databases for which the user has some kind of privilege. From version 4.0.2 this option is deprecated and doesn't do anything (the option is enabled by default) as we now have the SHOW DATABASES privilege. See GRANT. | |||||||||||
--safe-user-create | If this is enabled, a user can't create new users with the GRANT statement, if the user doesn't have INSERT privilege to the mysql.user table or any column in this table. | |||||||||||
--skip-bdb | Disable the BDB storage engine. This will save memory and may speed up some operations. | |||||||||||
--skip-concurrent-insert | Turn off the ability to select and insert at the same time on MyISAM tables. (This is only to be used if you think you have found a bug in this feature.) | |||||||||||
--skip-delay-key-write | Ignore the DELAY_KEY_WRITE option for all tables. As of MySQL 4.0.3, you should use --delay-key-write=OFF instead. See Server parameters. | |||||||||||
--skip-grant-tables | This option causes the server not to use the privilege system at all. This gives everyone full access to all databases! (You can tell a running server to start using the grant tables again by executing mysqladmin flush-privileges or mysqladmin reload.) | |||||||||||
--skip-host-cache | Never use the hostname cache for faster name-IP resolution, but query the DNS server on every connect instead. See DNS. | |||||||||||
--skip-innodb | Disable the InnoDB storage engine. This will save memory and disk space and speed up some operations. | |||||||||||
--skip-external-locking (was --skip-locking) | Don't use system locking. To use isamchk or myisamchk you must shut down the server. See Stability. Note that in MySQL Version 3.23 you can use REPAIR and CHECK to repair/check MyISAM tables. | |||||||||||
--skip-name-resolve | Hostnames are not resolved. All Host column values in the grant tables must be IP numbers or localhost. See DNS. | |||||||||||
--skip-networking | Don't listen for TCP/IP connections at all. All interaction with mysqld must be made via named pipes or Unix sockets. This option is highly recommended for systems where only local requests are allowed. See DNS. | |||||||||||
--skip-new | Don't use new, possibly wrong routines. | |||||||||||
--skip-symlink | Deprecated option in 4.0.13; use --skip-symbolic-links instead. | |||||||||||
--symbolic-links, --skip-symbolic-links | Enable or disable symbolic link support. This option has different effects on Windows and Unix. On Windows, enabling symbolic links allows you to establish a symbolic link to a database directory by creating a directory.sym file that contains the path to the real directory. See Windows symbolic links. On Unix, enabling symbolic links means that you can link a MyISAM index file or datafile to another directory with the INDEX DIRECTORY or DATA DIRECTORY options of the CREATE TABLE statement. If you delete or rename the table, the files that its symbolic links point to also will be deleted or renamed. See CREATE TABLE. | |||||||||||
--skip-safemalloc | If MySQL is configured with --with-debug=full, all programs check memory for overruns for every memory allocation and memory freeing operations. This checking is very slow, so for the server you can avoid it when you don't need it by using the --skip-safemalloc option. | |||||||||||
--skip-show-database | Don't allow the SHOW DATABASES statement, unless the user has the SHOW DATABASES privilege. | |||||||||||
--skip-stack-trace | Don't write stack traces. This option is useful when you are running mysqld under a debugger. On some systems, you also must use this option to get a core file. See Debugging server. | |||||||||||
--skip-thread-priority | Disable using thread priorities for faster response time. | |||||||||||
--socket=path | On Unix, the socket file to use for local connections (default /tmp/mysql.sock). On Windows, the pipe name to use for local connections that use a named pipe (default MySQL). | |||||||||||
--sql-mode=value[,value[,value...]] | Set the SQL mode for MySQL. See SQL mode. This option was added in 3.23.41. | |||||||||||
--temp-pool | Using this option will cause most temporary files created by the server to use a small set of names, rather than a unique name for each new file. This is to work around a problem in the Linux kernel dealing with creating many new files with different names. With the old behavior, Linux seems to ``leak'' memory, as it's being allocated to the directory entry cache rather than to the disk cache. | |||||||||||
--transaction-isolation=level | Sets the default transaction isolation level, which may be READ-UNCOMMITTED, READ-COMMITTED, REPEATABLE-READ, or SERIALIZABLE. See SET TRANSACTION. | |||||||||||
--tmpdir=path, -t path | Path of the directory to use for creating temporary files. It may be useful if your default /tmp directory resides on a partition that is too small to hold temporary tables. Starting from MySQL 4.1, this option accepts several paths that are used in round-robin fashion. Paths should be separated by colon characters (:) on Unix and semicolon characters (;) on Windows. It is possible to set tmpdir to point to a memory-based filesystem, except if the MySQL server is a slave. If it is a slave, it needs some of its temporary files (for replication of temporary tables or of LOAD DATA INFILE) to survive a machine's reboot, so a memory-based tmpdir which is cleared when the machine reboots is not suitable; a disk-based tmpdir is necessary. | |||||||||||
--user={user_name | user_id}, -u {user_name | user_id} | Run the mysqld server as the user having the name user_name or the numeric user ID user_id. (``User'' in this context refers to a system login account, not a MySQL user listed in the grant tables.) This option is mandatory when starting mysqld as root. The server will change its user ID during its startup sequence, causing it to run as that particular user rather than as root. See Security. Starting from MySQL 3.23.56 and 4.0.12: To avoid a possible security hole where a user adds a --user=root option to some my.cnf file (thus causing the server to run as root), mysqld uses only the first --user option specified and produces a warning if there are multiple --user options. Options in /etc/my.cnf and datadir/my.cnf are processed before command-line options, so it is recommended that you put a --user option in /etc/my.cnf and specify a value other than root. The option in /etc/my.cnf will be found before any other --user options, which ensures that the server runs as a user other than root, and that a warning results if any other --user option is found. | |||||||||||
--version, -V | Display version information and exit. |
You can change most values for a running server with the SET statement. See SET OPTION.