mysqld
mysqld [options
]
When mysqld
is started,
you can use various options. Although these options may be given on
the command line, it’s common practice to enter them
into a configuration file. On Unix-based systems, the main
configuration file typically is /etc/my.cnf. For
Windows systems, the main file is usually either
c:systemsmy.ini or c:my.conf.
Options are entered on separate lines and follow a
variable=value format. They are grouped under
headings contained within square brackets. The
mysqld daemon reads options from the
configuration file under the headings of [mysqld]
and [server]
as it’s started. The
following is an alphabetical list of options that apply to the
mysqld daemon and an explanation of each. The
options are shown as you would enter them from the command line. If
an option is used in a configuration file, you should use the long
form (not the dash with a single letter) and omit the double-dash
prefix. For example, you could enter
--basedir=/data/mysql
from the command line. In a
configuration file, though, you would enter
basedir=/data/mysql
on its own line.
--ansi
Instructs the server to use standard ANSI SQL syntax, rather than MySQL syntax.
--basedir=
path
, -b
path
Specifies the base directory for MySQL installation.
--big-tables
Instructs the server to save temporary results sets to a file to solve errors where results are large and tables are said to be full.
--bind-address=
address
Specifies the IP address upon which the server is to bind. Use it to restrict network access on a host with multiple IP addresses.
--character-set-server=
set
Start a server with a particular character set. It’s available as of Version 4.1.3 of MySQL.
--character-sets-dir=
path
Specifies the directory containing character sets.
--chroot=
path
Runs the
daemon with chroot( )
from the filesystem so as to
start it in a closed environment for additional security. This is a
recommended security measure as of Version 4 of MySQL. This option
has vulnerabilities under Version 3.23.
--collation-server=
collation
Starts a server with a particular collation. It’s available as of Version 4.1.3 of MySQL.
--console
Displays the error messages to stdout
and
stderr
.
--core-file
Instructs the server to create a core
file if the daemon dies. Some systems also require the
--skip-stack-trace
option to be set, as well. Some
systems also require the --core-file-size
option
when using mysqld_safe
. On Solaris systems, if the
--user
option is used also, the server will not
create the core file.
--datadir=
path
, -h
path
Specifies the directory that contains datafiles (i.e, database directories and table files).
--debug[=
options
]
, -#
[
options
]
Obtains a trace file of the
daemon’s activities. The debug options are typically
'd:t:o,filename
‘. MySQL has to be compiled for
debugging using the --with-debug
option when
configuring.
--default-character-set=
set
Specifies the default character set.
This option is deprecated as of Version 4.1.3 of MySQL. Use the
--character-set-server
option instead.
--default-collation=
collation
Specifies the collation to use as
default. This option is deprecated as of Version 4.1.3 of MySQL. Use
the --collation-server
option instead.
--default-storage-engine=
type
Specifies the default table type.
It’s synonymous with the
--default-table-type
option.
--default-table-type=
type
Changes the default table type. MyISAM is the default unless you change it with this option.
--default-time-zone=
zone
Specifies the default time zone for the server. The filesystem time zone is used by default.
--delay-key-write[=
option
]
Instructs the server on how to handle key buffers between writes for
MyISAM tables. The choices are OFF
,
ON
, and ALL
. The
ON
choice delays writes for tables created with
DELAYED KEYS
. The ALL
choice
delays writes for all MyISAM tables regardless. MyISAM tables should
not be accessed by another server or clients like
myisamcheck
when the ALL
choice
is used. It may cause corruption of indexes.
--delay-key-write-for-all-tables
Instructs the server not to flush key
buffers between writes for MyISAM tables. As of Version 4.0.3 of
MySQL, use --delay-key-write=ALL
instead.
--des-key-file=
filename
Instructs the server to obtain the
default keys from the file named when the MySQL functions
DES_ENCRYPT( )
or DES_DECRYPT()
are used.
--enable-named-pipe
This enables support for named pipe connections with the
mysqld-nt
and mysqld-max-nt
servers, which support them.
--exit-info[=
flags
], -T [
flags
]
Displays debugging information when the daemon exits.
--external-locking
Previously called
--enable-locking
, this option allows system
locking. Be careful when using this option on a platform with
problems with lockd
(e.g., Linux): the
mysqld daemon may lock and you might have to
reboot the server to unlock it.
--flush
Use this to have the server flush all changes to disk after each SQL statement and not to wait for the filesystem to determine the frequency of writes.
--help, -?
Displays basic help information and
more information when it’s combined with the
--verbose
option.
--init-file=
filename
Instructs the server to read the SQL commands contained in the file named at startup. Each SQL statement in the file must be on one line only and cannot include comments.
--innodb-safe-binlog
Ensures consistency between the content of InnoDB tables and the binary log.
--language=
language
, -L
language
Provides the name of the language preferred for user messages and, optionally, the path to the language file.
--log[=
filename
], -l [
filename
]
Instructs the server to log connection information and queries to the path and file named, or to the default (host.log) if none is given.
--log-bin[=
filename
]
Enables binary logging of changes to databases to the path and name of the file given. If a filename isn’t provided, the default name of host-bin.index will be used, where host is the hostname of the server and index is a numeric count.
--log-bin-index[=
filename
]
Names the path and filename for the index file for the binary log filenames. The default name for the log if none is specified with this option is host-bin.index, where host is the server’s hostname and index is a numeric count.
--log-error[=
filename
]
Activates logging of error messages and server start-up messages to the path and filename given. The default name for the log if none is specified with this option is host.err, where host is the server’s hostname.
--log-isam[=
filename
]
Activates logging of changes to ISAM and MyISAM tables to the path and filename given. This option is used only when debugging.
--log-long-format
Instructs the server to be more verbose
in logs. This is the default setting as of Version 4.1 of MySQL. Use
the --log-short-format
option to disable this
option.
--log-queries-not-using-indexes
When you use this with the
--log-slow-queries
option, all queries that do not
use indexes are logged to the slow query log. This option is
available as of Version 4.1 of MySQL.
--log-short-format
Instructs the server to be less verbose in logs. This option is available as of Version 4.1 of MySQL.
--log-slow-queries[=
filename
]
Instructs the server to log queries that take longer than the maximum
number of seconds specified in the value of the
long_query_time
variable. If
filename is specified, entries are recorded in
the logfile named.
--log-update[=
filename
]
Activates logging of updates to the path and filename given. This feature is deprecated in favor of binary logging.
--log-warnings, -W
Activates logging of warning messages.
Prior to Version 4 of MySQL, this option was invoked with the
--warnings
option. After Version 4.1.2, this
option is enabled by default and can be disabled with the
--skip-log-warnings
option.
--low-priority-updates
Sets all SQL statements that modify data to a lower priority by
default than SELECT
statements.
--memlock
Use this on filesystems that support mlockall( )
system calls (e.g., Solaris) to lock the daemon in memory and thereby
avoid the use of disk swapping and improving performance. It requires
the daemon to be started by root, which may be a
security problem.
--myisam-recover[=
options
]
Sets the MyISAM storage engine’s recovery mode so
that all MyISAM tables will be automatically checked and repaired if
needed when the server starts. The choices of settings are
BACKUP
(makes backups of recovered tables that
were changed), DEFAULT
(disables this option),
FORCE
(runs recovery regardless of the risk of
losing data), and QUICK
(doesn’t
check rows for tables without any deletions). Multiple choices may be
given in a comma-separated list.
--ndbcluster
--nbd-connectstring=
string
Specifies the connect string when using the NDB Cluster storage engine.
--new, -n
At the time of this writing, this option tests queries before upgrading from Version 4 to 4.1 of MySQL.
--old-protocol, -o
Has the server use Version 3.2 protocol of MySQL for compatibility with older clients.
--one-thread
Instructs the server to allow only one thread when debugging a Linux system.
--open-files-limit=
number
Specifies the maximum number of file descriptors for the daemon.
--pid-file=
path
Specifies the path to the process
identifier file when using mysqld_safe
.
--port=
port
, -P
port
Specifies the port on which the server will listen for client connections.
--safe-mode
Disables some optimization at startup.
--safe-show-database
Hides database names that a user does not have permission to access.
--safe-user-create
Prevents a user from creating new
users without INSERT
privileges for the
user table in the mysql
database.
--secure
--secure-auth
Prevents authentication of users with passwords created prior to Version 4.1 of MySQL.
--set-variable
variable=value
Sets a server variable. Enter
mysqld --verbose --help
for the current values for
a particular server’s variables.
--shared-memory
Allows shared memory connections by Windows clients locally. This option is available as of Version 4.1 of MySQL.
--shared-memory-base-name=
name
Sets the name to use for shared memory connections in Windows. This option is available as of Version 4.1 of MySQL.
--skip-bdb
--skip-concurrent-insert
Prevents simultaneous
SELECT
and INSERT
statements
for MyISAM tables.
--skip-delay-key-write
Disregards tables marked as DELAY_KEY_WRITE
. As of
Version 4.0.3 of MySQL, use --delay-key-write=OFF
instead.
--skip-external-locking
Previously called
--skip-locking
, this option prevents system
locking.
--skip-grant-tables
Instructs the server not to use the grants
table and thus give all users full access. This is a security risk.
If this option is used, restarting the server without this option or
running the FLUSH PRIVILEGES
statement from the
terminal mode will re-enable privileges. You can use this option if
you have lost the root password. It lets you log
in without the password and then reset it.
--skip-host-cache
Disables the use of the internal host cache and requires DNS lookup for each new connection.
--skip-innodb
--skip-isam
This option disables the ISAM storage engine. As of Version 4.1 of MySQL, this option is on by default.
--skip-locking
Disables server system locking.
--skip-name-resolve
This option requires a client’s IP address to be named in the privileges tables for tighter security and faster connections.
--skip-ndbcluster
--skip-networking
Prevents network connections of clients and allows local connections only.
--skip-new
Instructs the server not to use new, questionable routines.
--skip-safemalloc
Prevents the server from checking for memory overruns when performing memory allocation and memory-freeing activities.
--skip-show-database
Prevents the SHOW
DATABASES
statement from being executed by users without
that specific privilege.
--skip-stack-trace
Prevents the writing of stack traces.
--skip-symlink
Disables support for symbolic links. As of
Version 4.0.3 of MySQL, use --symbolic-links
to
enable symbolic links and --skip-symbolic-links
to
disable them.
--skip-thread-priority
Prevents prioritizing of threads.
--socket=
filename
Provides the path and name of the socket file to be generated (/tmp/mysql.sock on Unix systems by default). On Windows systems, this option is used to provide the pipe name (MySQL by default) for local connections.
--sql-mode=
value
Sets the SQL mode. Multiple values may be given in a comma-separated list.
--temp-pool
Instructs the server to utilize a small set of names for temporary file naming rather than unique names for each file.
--tmpdir=
path
, -t
path
Names the directory for the server to write temporary files. Multiple paths may be given in a colon-separated list.
--transaction-isolation=
option
Sets the default transaction isolation level. The various levels
available are READ-UNCOMMITTED
,
READ-COMMITTED
,
REPEATABLE-READ
, and
SERIALIZABLE
.
--user=
user
, -u
user
Starts the daemon with the filesystem username or user identifier number given. This is particularly useful when starting the daemon while logged in as root.
--version, -v
18.217.37.215