MySQL/MariaDB数据库的服务器配置

时间:2021-10-06 06:02:29

      MySQL/MariaDB数据库的服务器配置

                            作者:尹正杰

版权声明:原创作品,谢绝转载!否则将追究法律责任。

一.MySQL中的系统数据库

1>.mysql数据库

  是mysql的核心数据库,类似于Sql Server中的master库,主要负责存储数据库的用户、权限设置、关键字等mysql自己需要使用的控制和管理信息

2>.performance_schema数据库

  MySQL 5.5开始新增的数据库,主要用于收集数据库服务器性能参数,库里表的存储引擎均为PERFORMANCE_SCHEMA,用户不能创建存储引擎为PERFORMANCE_SCHEMA的表

3>.information_schema数据库

  MySQL 5.0之后产生的,一个虚拟数据库,物理上并不存在information_schema数据库类似与“数据字典”,提供了访问数据库元数据的方式,即数据的数据。比如数据库名或表名,列类型,访问权限(更加细化的访问方式)

二.服务器端设置

1>.服务器配置

  服务器配置包括mysqld选项,服务器系统变量和服务器状态变量;

  其中有些参数支持运行时修改,会立即生效;有些参数不支持,且只能通过修改配置文件,并重启服务器程序生效;有些参数作用域是全局的,且不可改变;有些可以为每个用户提供单独(会话)的设置

  博主推荐阅读:
    https://dev.mysql.com/doc/refman/5.7/en/server-option-variable-reference.html
    https://mariadb.com/kb/en/library/full-list-of-mariadb-options-system-and-status-variables/

2>.获取mysqld的可用选项列表

[root@node105.yinzhengjie.org.cn ~]# mysqld --help --verbose | more
-- :: [Warning] 'THREAD_CONCURRENCY' is deprecated and will be removed in a future release.
-- :: [Note] Plugin 'FEEDBACK' is disabled.
mysqld Ver 10.2.-MariaDB-log for Linux on x86_64 (MariaDB Server)
Copyright (c) , , Oracle, MariaDB Corporation Ab and others. Starts the MariaDB database server. Usage: mysqld [OPTIONS] Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf ~/.my.cnf
The following groups are read: mysqld server mysqld-10.2 mariadb mariadb-10.2 client-server galera
The following options may be given as the first argument:
--print-defaults Print the program argument list and exit.
--no-defaults Don't read default options from any option file.
The following specify which files/extra groups are read (specified before remaining options):
--defaults-file=# Only read default options from the given file #.
--defaults-extra-file=# Read this file after the global files are read.
--defaults-group-suffix=# Additionally read default groups with # appended as a suffix. --allow-suspicious-udfs
Allows use of UDFs consisting of only one symbol xxx()
without corresponding xxx_init() or xxx_deinit(). That
also means that one can load any function from any
library, for example exit() from libc.so
-a, --ansi Use ANSI SQL syntax instead of MySQL syntax. This mode
will also set transaction isolation level 'serializable'.
--aria[=name] Enable or disable Aria plugin. One of: ON, OFF, FORCE
(don't start if the plugin fails to load).
--aria-block-size=# Block size to be used for Aria index pages.
--aria-checkpoint-interval=#
Interval between tries to do an automatic checkpoints. In
seconds; means 'no automatic checkpoints' which makes
sense only for testing.
--aria-checkpoint-log-activity=#
Number of bytes that the transaction log has to grow
between checkpoints before a new checkpoint is written to
the log.
--aria-encrypt-tables
Encrypt tables (only for tables with ROW_FORMAT=PAGE
(default) and not FIXED/DYNAMIC)
--aria-force-start-after-recovery-failures=#
Number of consecutive log recovery failures after which
logs will be automatically deleted to cure the problem;
(the default) disables the feature.
--aria-group-commit=name
Specifies Aria group commit mode. Possible values are
"none" (no group commit), "hard" (with waiting to actual
commit), "soft" (no wait for commit (DANGEROUS!!!))
--aria-group-commit-interval=#
Interval between commite in microseconds (/1000000c).
stands for no waiting for other threads to come and do a
commit in "hard" mode and no sync()/commit at all in
"soft" mode. Option has only an effect if
aria_group_commit is used
--aria-log-dir-path=name
Path to the directory where to store transactional log
--aria-log-file-size=#
Limit for transaction log size
--aria-log-purge-type=name
Specifies how Aria transactional log will be purged. One
of: immediate, external, at_flush
--aria-max-sort-file-size=#
Don't use the fast sort index method to created index if
the temporary file would get bigger than this.
--aria-page-checksum
Maintain page checksums (can be overridden per table with
PAGE_CHECKSUM clause in CREATE TABLE)
(Defaults to on; use --skip-aria-page-checksum to disable.)
--aria-pagecache-age-threshold=#
This characterizes the number of hits a hot block has to
be untouched until it is considered aged enough to be
downgraded to a warm block. This specifies the percentage
ratio of that number of hits to the total number of
blocks in the page cache.
--aria-pagecache-buffer-size=#
The size of the buffer used for index blocks for Aria
tables. Increase this to get better index handling (for
all reads and multiple writes) to as much as you can
afford.
--aria-pagecache-division-limit=#
The minimum percentage of warm blocks in key cache
--aria-pagecache-file-hash-size=#
Number of hash buckets for open and changed files. If
you have a lot of Aria files open you should increase
this for faster flush of changes. A good value is
probably / of number of possible open Aria files.
--aria-recover-options[=name]
Specifies how corrupted tables should be automatically
repaired. Any combination of: NORMAL, BACKUP, FORCE,
QUICK, OFF
--aria-repair-threads=#
Number of threads to use when repairing Aria tables. The
value of disables parallel repair.
--aria-sort-buffer-size=#
The buffer that is allocated when sorting the index when
doing a REPAIR or when creating indexes with CREATE INDEX
or ALTER TABLE.
--aria-stats-method=name
Specifies how Aria index statistics collection code
should treat NULLs. One of: nulls_unequal, nulls_equal,
nulls_ignored
--aria-sync-log-dir=name
Controls syncing directory after log file growth and new
file creation. One of: NEVER, NEWFILE, ALWAYS
--auto-increment-increment[=#]
Auto-increment columns are incremented by this
--auto-increment-offset[=#]
Offset added to Auto-increment columns. Used when
auto-increment-increment !=
--autocommit Set default value for autocommit ( or )
(Defaults to on; use --skip-autocommit to disable.)
--automatic-sp-privileges
Creating and dropping stored procedures alters ACLs
(Defaults to on; use --skip-automatic-sp-privileges to disable.)
--back-log=# The number of outstanding connection requests MariaDB can
have. This comes into play when the main MariaDB thread
gets very many connection requests in a very short time
(Automatically configured unless set explicitly)
-b, --basedir=name Path to installation directory. All paths are usually
resolved relative to this
--big-tables Old variable, which if set to , allows large result sets
by saving all temporary sets to disk, avoiding 'table
full' errors. No longer needed, as the server now handles
this automatically. sql_big_tables is a synonym.
--bind-address=name IP address to bind to.
--binlog-annotate-row-events
Tells the master to annotate RBR events with the
statement that caused these events
(Defaults to on; use --skip-binlog-annotate-row-events to disable.)
--binlog-cache-size=#
The size of the transactional cache for updates to
transactional engines for the binary log. If you often
use transactions containing many statements, you can
increase this to get more performance
--binlog-checksum=name
Type of BINLOG_CHECKSUM_ALG. Include checksum for log
events in the binary log. One of: NONE, CRC32
--binlog-commit-wait-count=#
If non-zero, binlog write will wait at most
binlog_commit_wait_usec microseconds for at least this
many commits to queue up for group commit to the binlog.
This can reduce I/O on the binlog and provide increased
opportunity for parallel apply on the slave, but too high
a value will decrease commit throughput.
--binlog-commit-wait-usec=#
Maximum time, in microseconds, to wait for more commits
to queue up for binlog group commit. Only takes effect if
the value of binlog_commit_wait_count is non-zero.
--binlog-direct-non-transactional-updates
Causes updates to non-transactional engines using
statement format to be written directly to binary log.
Before using this option make sure that there are no
dependencies between transactional and non-transactional
tables such as in the statement INSERT INTO t_myisam
SELECT * FROM t_innodb; otherwise, slaves may diverge
from the master.
--binlog-do-db=name Tells the master it should log updates for the specified
database, and exclude all others not explicitly
mentioned.
--binlog-format=name
What form of binary logging the master will use: either
ROW for row-based binary logging, STATEMENT for
statement-based binary logging, or MIXED. MIXED is
statement-based binary logging except for those
statements where only row-based is correct: those which
involve user-defined functions (i.e. UDFs) or the UUID()
function; for those, row-based binary logging is
automatically used.
--binlog-ignore-db=name
Tells the master that updates to the given database
should not be logged to the binary log.
--binlog-optimize-thread-scheduling
Run fast part of group commit in a single thread, to
optimize kernel thread scheduling. On by default. Disable
to run each transaction in group commit in its own
thread, which can be slower at very high concurrency.
This option is mostly for testing one algorithm versus
the other, and it should not normally be necessary to
change it.
(Defaults to on; use --skip-binlog-optimize-thread-scheduling to disable.)
--binlog-row-event-max-size=#
The maximum size of a row-based binary log event in
bytes. Rows will be grouped into events smaller than this
size if possible. The value has to be a multiple of .
--binlog-row-image=name
Controls whether rows should be logged in 'FULL',
'NOBLOB' or 'MINIMAL' formats. 'FULL', means that all
columns in the before and after image are logged.
'NOBLOB', means that mysqld avoids logging blob columns
whenever possible (eg, blob column was not changed or is
not part of primary key). 'MINIMAL', means that a PK
equivalent (PK columns or full row if there is no PK in
the table) is logged in the before image, and only
changed columns are logged in the after image. (Default:
FULL).
--binlog-stmt-cache-size=#
The size of the statement cache for updates to
non-transactional engines for the binary log. If you
often use statements updating a great number of rows, you
can increase this to get more performance.
--bootstrap Used by mysql installation scripts.
--bulk-insert-buffer-size=#
Size of tree cache used in bulk insert optimisation. Note
that this is a limit per thread!
--character-set-client-handshake
Don't ignore client side character set value sent during
handshake.
(Defaults to on; use --skip-character-set-client-handshake to disable.)
--character-set-filesystem=name
Set the filesystem character set.
-C, --character-set-server=name
Set the default character set.
--character-sets-dir=name
Directory where character sets are
-r, --chroot=name Chroot mysqld daemon during startup.
--collation-server=name
Set the default collation.
--completion-type=name
The transaction completion type. One of: NO_CHAIN, CHAIN,
RELEASE
--concurrent-insert[=name]
Use concurrent insert with MyISAM. One of: NEVER, AUTO,
ALWAYS
--connect-timeout=# The number of seconds the mysqld server is waiting for a
connect packet before responding with 'Bad handshake'
--console Write error output on screen; don't remove the console
window on windows.
--core-file Write core on errors.
-h, --datadir=name Path to the database root directory
--date-format=name The DATE format (ignored)
--datetime-format=name
The DATETIME format (ignored)
--deadlock-search-depth-long=#
Long search depth for the two-step deadlock detection
--deadlock-search-depth-short=#
Short search depth for the two-step deadlock detection
--deadlock-timeout-long=#
Long timeout for the two-step deadlock detection (in
microseconds)
--deadlock-timeout-short=#
Short timeout for the two-step deadlock detection (in
microseconds)
-#, --debug[=name] Built in DBUG debugger. Disabled in this build.
--debug-abort-slave-event-count=#
Option used by mysql-test for debugging and testing of
replication.
--debug-disconnect-slave-event-count=#
Option used by mysql-test for debugging and testing of
replication.
-T, --debug-exit-info[=#]
Used for debugging. Use at your own risk.
--debug-gdb Set up signals usable for debugging.
--debug-max-binlog-dump-events=#
Option used by mysql-test for debugging and testing of
replication.
--debug-no-sync Disables system sync calls. Only for running tests or
debugging!
--debug-no-thread-alarm
Disable system thread alarm calls. Disabling it may be
useful in debugging or testing, never do it in production
--debug-sporadic-binlog-dump-fail
Option used by mysql-test for debugging and testing of
replication.
--default-regex-flags=name
Default flags for the regex library. Any combination of:
DOTALL, DUPNAMES, EXTENDED, EXTRA, MULTILINE, UNGREEDY
--default-storage-engine=name
The default storage engine for new tables
--default-time-zone=name
Set the default time zone.
--default-tmp-storage-engine=name
The default storage engine for user-created temporary
tables
--default-week-format=#
The default week format used by WEEK() functions
--delay-key-write[=name]
Specifies how MyISAM tables handles CREATE TABLE
DELAY_KEY_WRITE. If set to ON, the default, any DELAY KEY
WRITEs are honored. The key buffer is then flushed only
when the table closes, speeding up writes. MyISAM tables
should be automatically checked upon startup in this
case, and --external locking should not be used, as it
can lead to index corruption. If set to OFF, DELAY KEY
WRITEs are ignored, while if set to ALL, all new opened
tables are treated as if created with DELAY KEY WRITEs
enabled.
--delayed-insert-limit=#
After inserting delayed_insert_limit rows, the INSERT
DELAYED handler will check if there are any SELECT
statements pending. If so, it allows these to execute
before continuing.
--delayed-insert-timeout=#
How long a INSERT DELAYED thread should wait for INSERT
statements before terminating
--delayed-queue-size=#
What size queue (in rows) should be allocated for
handling INSERT DELAYED. If the queue becomes full, any
client that does INSERT DELAYED will wait until there is
room in the queue again
--des-key-file=name Load keys for des_encrypt() and des_encrypt from given
file.
--div-precision-increment=#
Precision of the result of '/' operator will be increased
on that value
--encrypt-binlog Encrypt binary logs (including relay logs)
--encrypt-tmp-disk-tables
Encrypt temporary on-disk tables (created as part of
query execution)
--encrypt-tmp-files Encrypt temporary files (created for filesort, binary log
cache, etc)
--enforce-storage-engine=name
Force the use of a storage engine for new tables
--eq-range-index-dive-limit=#
The optimizer will use existing index statistics instead
of doing index dives for equality ranges if the number of
equality ranges for the index is larger than or equal to
this number. If set to , index dives are always used.
--event-scheduler[=name]
Enable the event scheduler. Possible values are ON, OFF,
and DISABLED (keep the event scheduler completely
deactivated, it cannot be activated run-time)
--expensive-subquery-limit=#
The maximum number of rows a subquery may examine in
order to be executed during optimization and used for
constant optimization
--expire-logs-days=#
If non-zero, binary logs will be purged after
expire_logs_days days; possible purges happen at startup
and at binary log rotation
--explicit-defaults-for-timestamp
This option causes CREATE TABLE to create all TIMESTAMP
columns as NULL with DEFAULT NULL attribute, Without this
option, TIMESTAMP columns are NOT NULL and have implicit
DEFAULT clauses. The old behavior is deprecated.
--external-locking Use system (external) locking (disabled by default).
With this option enabled you can run myisamchk to test
(not repair) tables while the MySQL server is running.
Disable with --skip-external-locking.
--extra-max-connections=#
The number of connections on extra-port
--extra-port=# Extra port number to use for tcp connections in a
one-thread-per-connection manner. means don't use
another port
--feedback[=name] Enable or disable FEEDBACK plugin. One of: ON, OFF, FORCE
(don't start if the plugin fails to load).
--feedback-http-proxy=name
Proxy server host:port.
--feedback-send-retry-wait=#
Wait this many seconds before retrying a failed send.
--feedback-send-timeout=#
Timeout (in seconds) for the sending the report.
--feedback-url=name Space separated URLs to send the feedback report to.
--feedback-user-info=name
User specified string that will be included in the
feedback report.
--flashback Setup the server to use flashback. This enables binary
log in row mode and will enable extra logging for DDL's
needed by flashback feature
--flush Flush MyISAM tables to disk between SQL commands
--flush-time=# A dedicated thread is created to flush all tables at the
given interval
--ft-boolean-syntax=name
List of operators for MATCH ... AGAINST ( ... IN BOOLEAN
MODE)
--ft-max-word-len=# The maximum length of the word to be included in a
FULLTEXT index. Note: FULLTEXT indexes must be rebuilt
after changing this variable
--ft-min-word-len=# The minimum length of the word to be included in a
FULLTEXT index. Note: FULLTEXT indexes must be rebuilt
after changing this variable
--ft-query-expansion-limit=#
Number of best matches to use for query expansion
--ft-stopword-file=name
Use stopwords from this file instead of built-in list
--gdb Set up signals usable for debugging. Deprecated, use
--debug-gdb instead.
--general-log Log connections and queries to a table or log file.
Defaults logging to a file 'hostname'.log or a table
mysql.general_logif --log-output=TABLE is used.
--general-log-file=name
Log connections and queries to given file
--getopt-prefix-matching
Recognize command-line options by their unambiguos
prefixes.
(Defaults to on; use --skip-getopt-prefix-matching to disable.)
--group-concat-max-len=#
The maximum length of the result of function
GROUP_CONCAT()
--gtid-domain-id=# Used with global transaction ID to identify logically
independent replication streams. When events can
propagate through multiple parallel paths (for example
multiple masters), each independent source server must
use a distinct domain_id. For simple tree-shaped
replication topologies, it can be left at its default, .
--gtid-ignore-duplicates
When set, different master connections in multi-source
replication are allowed to receive and process event
groups with the same GTID (when using GTID mode). Only
one will be applied, any others will be ignored. Within a
given replication domain, just the sequence number will
be used to decide whether a given GTID has been already
applied; this means it is the responsibility of the user
to ensure that GTID sequence numbers are strictly
increasing.
--gtid-strict-mode Enforce strict seq_no ordering of events in the binary
log. Slave stops with an error if it encounters an event
that would cause it to generate an out-of-order binlog if
executed.
-?, --help Display this help and exit.
--histogram-size=# Number of bytes used for a histogram. If set to , no
histograms are created by ANALYZE.
--histogram-type=name
Specifies type of the histograms created by ANALYZE.
Possible values are: SINGLE_PREC_HB - single precision
height-balanced, DOUBLE_PREC_HB - double precision
height-balanced.
--host-cache-size=# How many host names should be cached to avoid resolving.
(Automatically configured unless set explicitly)
--ignore-builtin-innodb
Disable initialization of builtin InnoDB plugin
--ignore-db-dirs=name
Specifies a directory to add to the ignore list when
collecting database names from the datadir. Put a blank
argument to reset the list accumulated so far.
--init-connect=name Command(s) that are executed for each new connection
(unless the user has SUPER privilege)
--init-file=name Read SQL commands from this file at startup
--init-rpl-role=name
Set the replication role. One of: MASTER, SLAVE
--init-slave=name Command(s) that are executed by a slave server each time
the SQL thread starts
--innodb[=name] Enable or disable InnoDB plugin. One of: ON, OFF, FORCE
(don't start if the plugin fails to load).
--innodb-adaptive-flushing
Attempt flushing dirty pages to avoid IO bursts at
checkpoints.
(Defaults to on; use --skip-innodb-adaptive-flushing to disable.)
--innodb-adaptive-flushing-lwm=#
Percentage of log capacity below which no adaptive
flushing happens.
--innodb-adaptive-hash-index
Enable InnoDB adaptive hash index (enabled by default).
Disable with --skip-innodb-adaptive-hash-index.
(Defaults to on; use --skip-innodb-adaptive-hash-index to disable.)
--innodb-adaptive-hash-index-partitions[=#]
It is an alias for innodb_adaptive_hash_index_parts; only
exists to allow easier upgrade from earlier XtraDB
versions.
--innodb-adaptive-hash-index-parts[=#]
Number of InnoDB Adaptive Hash Index Partitions (default
)
--innodb-adaptive-max-sleep-delay=#
The upper limit of the sleep delay in usec. Value of
disables it.
--innodb-autoextend-increment=#
Data file autoextend increment in megabytes
--innodb-autoinc-lock-mode=#
The AUTOINC lock modes supported by InnoDB: => Old
style AUTOINC locking (for backward compatibility); =>
New style AUTOINC locking; => No AUTOINC locking
(unsafe for SBR)
--innodb-background-scrub-data-check-interval=#
check if spaces needs scrubbing every
innodb_background_scrub_data_check_interval seconds
--innodb-background-scrub-data-compressed
Enable scrubbing of compressed data by background threads
(same as encryption_threads)
--innodb-background-scrub-data-interval=#
scrub spaces that were last scrubbed longer than
innodb_background_scrub_data_interval seconds ago
--innodb-background-scrub-data-uncompressed
Enable scrubbing of uncompressed data by background
threads (same as encryption_threads)
--innodb-buf-dump-status-frequency=#
A number between [, ] that tells how oftern buffer
pool dump status in percentages should be printed. E.g.
means that buffer pool dump status is printed when
every % of number of buffer pool pages are dumped.
Default is (only start and end status is printed).
--innodb-buffer-page[=name]
Enable or disable INNODB_BUFFER_PAGE plugin. One of: ON,
OFF, FORCE (don't start if the plugin fails to load).
--innodb-buffer-page-lru[=name]
Enable or disable INNODB_BUFFER_PAGE_LRU plugin. One of:
ON, OFF, FORCE (don't start if the plugin fails to load).
--innodb-buffer-pool-chunk-size=#
Size of a single memory chunk within each buffer pool
instance for resizing buffer pool. Online buffer pool
resizing happens at this granularity. means disable
resizing buffer pool.
--innodb-buffer-pool-dump-at-shutdown
Dump the buffer pool into a file named
@@innodb_buffer_pool_filename
(Defaults to on; use --skip-innodb-buffer-pool-dump-at-shutdown to disable.)
--innodb-buffer-pool-dump-now
Trigger an immediate dump of the buffer pool into a file
named @@innodb_buffer_pool_filename
--innodb-buffer-pool-dump-pct=#
Dump only the hottest N% of each buffer pool, defaults to --innodb-buffer-pool-filename=name
Filename to/from which to dump/load the InnoDB buffer
pool
--innodb-buffer-pool-instances=#
Number of buffer pool instances, set to higher value on
high-end machines to increase scalability
--innodb-buffer-pool-load-abort
Abort a currently running load of the buffer pool
--innodb-buffer-pool-load-at-startup
Load the buffer pool from a file named
@@innodb_buffer_pool_filename
(Defaults to on; use --skip-innodb-buffer-pool-load-at-startup to disable.)
--innodb-buffer-pool-load-now
Trigger an immediate load of the buffer pool from a file
named @@innodb_buffer_pool_filename
--innodb-buffer-pool-populate
Deprecated and ignored; only exists to allow easier
upgrade from earlier XtraDB versions.
--innodb-buffer-pool-size=#
The size of the memory buffer InnoDB uses to cache data
and indexes of its tables.
--innodb-buffer-pool-stats[=name]
Enable or disable INNODB_BUFFER_POOL_STATS plugin. One
of: ON, OFF, FORCE (don't start if the plugin fails to
load).
--innodb-change-buffer-max-size=#
Maximum on-disk size of change buffer in terms of
percentage of the buffer pool.
--innodb-change-buffering=name
Buffer changes to reduce random access: OFF, ON,
inserting, deleting, changing, or purging.
--innodb-checksum-algorithm=name
The algorithm InnoDB uses for page checksumming. Possible
values are CRC32 (hardware accelerated if the CPU
supports it) write crc32, allow any of the other
checksums to match when reading; STRICT_CRC32 write
crc32, do not allow other algorithms to match when
reading; INNODB write a software calculated checksum,
allow any other checksums to match when reading;
STRICT_INNODB write a software calculated checksum, do
not allow other algorithms to match when reading; NONE
write a constant magic number, do not do any checksum
verification when reading (same as innodb_checksums=OFF);
STRICT_NONE write a constant magic number, do not allow
values other than that magic number when reading; Files
updated when this option is set to crc32 or strict_crc32
will not be readable by MariaDB versions older than
10.0.
--innodb-checksums DEPRECATED. Use innodb_checksum_algorithm=NONE instead of
setting this to OFF. Enable InnoDB checksums validation
(enabled by default). Disable with
--skip-innodb-checksums.
(Defaults to on; use --skip-innodb-checksums to disable.)
--innodb-cleaner-lsn-age-factor[=name]
Deprecated and ignored; only exists to allow easier
upgrade from earlier XtraDB versions.. One of: LEGACY,
HIGH_CHECKPOINT, DEPRECATED
--innodb-cmp[=name] Enable or disable INNODB_CMP plugin. One of: ON, OFF,
FORCE (don't start if the plugin fails to load).
--innodb-cmp-per-index[=name]
Enable or disable INNODB_CMP_PER_INDEX plugin. One of:
ON, OFF, FORCE (don't start if the plugin fails to load).
--innodb-cmp-per-index-enabled
Enable INFORMATION_SCHEMA.innodb_cmp_per_index, may have
negative impact on performance (off by default)
--innodb-cmp-per-index-reset[=name]
Enable or disable INNODB_CMP_PER_INDEX_RESET plugin. One
of: ON, OFF, FORCE (don't start if the plugin fails to
load).
--innodb-cmp-reset[=name]
Enable or disable INNODB_CMP_RESET plugin. One of: ON,
OFF, FORCE (don't start if the plugin fails to load).
--innodb-cmpmem[=name]
Enable or disable INNODB_CMPMEM plugin. One of: ON, OFF,
FORCE (don't start if the plugin fails to load).
--innodb-cmpmem-reset[=name]
Enable or disable INNODB_CMPMEM_RESET plugin. One of: ON,
OFF, FORCE (don't start if the plugin fails to load).
--innodb-commit-concurrency=#
Helps in performance tuning in heavily concurrent
environments.
--innodb-compression-algorithm[=name]
Compression algorithm used on page compression. One of:
none, zlib, lz4, lzo, lzma, or bzip2
--innodb-compression-default
Is compression the default for new tables
--innodb-compression-failure-threshold-pct[=#]
If the compression failure rate of a table is greater
than this number more padding is added to the pages to
reduce the failures. A value of zero implies no padding
--innodb-compression-level=#
Compression level used for zlib compression. is no
compression, is fastest, is best compression and
default is .
--innodb-compression-pad-pct-max[=#]
Percentage of empty space on a data page that can be
reserved to make the page compressible.
--innodb-concurrency-tickets=#
Number of times a thread is allowed to enter InnoDB
within the same SQL query after it has once got the
ticket
--innodb-corrupt-table-action=name
Deprecated and ignored; only exists to allow easier
upgrade from earlier XtraDB versions.. One of: assert,
warn, salvage, deprecated
--innodb-data-file-path=name
Path to individual files and their sizes.
--innodb-data-home-dir=name
The common part for InnoDB table spaces.
--innodb-deadlock-detect
Enable/disable InnoDB deadlock detector (default ON). if
set to OFF, deadlock detection is skipped, and we rely on
innodb_lock_wait_timeout in case of deadlock.
(Defaults to on; use --skip-innodb-deadlock-detect to disable.)
--innodb-default-encryption-key-id=#
Default encryption key id used for table encryption.
--innodb-default-row-format=name
The default ROW FORMAT for all innodb tables created
without explicit ROW_FORMAT. Possible values are
REDUNDANT, COMPACT, and DYNAMIC. The ROW_FORMAT value
COMPRESSED is not allowed. One of: redundant, compact,
dynamic
--innodb-defragment Enable/disable InnoDB defragmentation (default FALSE).
When set to FALSE, all existing defragmentation will be
paused. And new defragmentation command will fail.Paused
defragmentation commands will resume when this variable
is set to true again.
--innodb-defragment-fill-factor=#
A number between [0.7, ] that tells defragmentation how
full it should fill a page. Default is 0.9. Number below
0.7 won't make much sense.This variable, together with
innodb_defragment_fill_factor_n_recs, is introduced so
defragmentation won't pack the page too full and cause
page split on the next insert on every page. The variable
indicating more defragmentation gain is the one
effective.
--innodb-defragment-fill-factor-n-recs=#
How many records of space defragmentation should leave on
the page. This variable, together with
innodb_defragment_fill_factor, is introduced so
defragmentation won't pack the page too full and cause
page split on the next insert on every page. The variable
indicating more defragmentation gain is the one
effective.
--innodb-defragment-frequency=#
Do not defragment a single index more than this number of
time per second.This controls the number of time
defragmentation thread can request X_LOCK on an index.
Defragmentation thread will check whether
/defragment_frequency (s) has passed since it worked on
this index last time, and put the index back to the queue
if not enough time has passed. The actual frequency can
only be lower than this given number.
--innodb-defragment-n-pages=#
Number of pages considered at once when merging multiple
pages to defragment
--innodb-defragment-stats-accuracy=#
How many defragment stats changes there are before the
stats are written to persistent storage. Set to meaning
disable defragment stats tracking.
--innodb-disable-sort-file-cache
Whether to disable OS system file cache for sort I/O
--innodb-doublewrite
Enable InnoDB doublewrite buffer (enabled by default).
Disable with --skip-innodb-doublewrite.
(Defaults to on; use --skip-innodb-doublewrite to disable.)
--innodb-empty-free-list-algorithm[=name]
Deprecated and ignored; only exists to allow easier
upgrade from earlier XtraDB versions.. One of: LEGACY,
BACKOFF, DEPRECATED
--innodb-encrypt-log
Enable redo log encryption
--innodb-encrypt-tables[=name]
Enable encryption for tables. Don't forget to enable
--innodb-encrypt-log too. One of: OFF, ON, FORCE
--innodb-encryption-rotate-key-age=#
Key rotation - re-encrypt in background all pages that
were encrypted with a key that many (or more) versions
behind. Value indicates that key rotation is disabled.
--innodb-encryption-rotation-iops=#
Use this many iops for background key rotation
--innodb-encryption-threads=#
Number of threads performing background key rotation and
scrubbing
--innodb-fake-changes
Deprecated and ignored; only exists to allow easier
upgrade from earlier XtraDB versions.
--innodb-fast-shutdown[=#]
Speeds up the shutdown process of the InnoDB storage
engine. Possible values are , (faster) or (fastest -
crash-like).
--innodb-fatal-semaphore-wait-threshold=#
Maximum number of seconds that semaphore times out in
InnoDB.
--innodb-file-format=name
File format to use for new tables in .ibd files.
--innodb-file-format-check
Whether to perform system file format check.
(Defaults to on; use --skip-innodb-file-format-check to disable.)
--innodb-file-format-max[=name]
The highest file format in the tablespace.
--innodb-file-io-threads=#
Deprecated and ignored; only exists to allow easier
upgrade from earlier XtraDB versions.
--innodb-file-per-table
Stores each InnoDB table to an .ibd file in the database
dir.
(Defaults to on; use --skip-innodb-file-per-table to disable.)
--innodb-fill-factor=#
Percentage of B-tree page filled during bulk insert
--innodb-flush-log-at-timeout[=#]
Write and flush logs every (n) second.
--innodb-flush-log-at-trx-commit[=#]
Controls the durability/speed trade-off for commits. Set
to (write and flush redo log to disk only once per
second), (flush to disk at each commit), (write to
log at commit but flush to disk only once per second) or
(flush to disk at prepare and at commit, slower and
usually redundant). and guarantees that after a
crash, committed transactions will not be lost and will
be consistent with the binlog and other transactional
engines. can get inconsistent and lose transactions if
there is a power failure or kernel crash but not if
mysqld crashes. has no guarantees in case of crash.
and can be faster than or .
--innodb-flush-method=name
With which method to flush data.
--innodb-flush-neighbors[=#]
Set to (don't flush neighbors from buffer pool), 1
(flush contiguous neighbors from buffer pool) or (flush
neighbors from buffer pool), when flushing a block
--innodb-flush-sync Allow IO bursts at the checkpoints ignoring io_capacity
setting.
(Defaults to on; use --skip-innodb-flush-sync to disable.)
--innodb-flushing-avg-loops=#
Number of iterations over which the background flushing
is averaged.
--innodb-force-load-corrupted
Force InnoDB to load metadata of corrupted table.
--innodb-force-primary-key
Do not allow to create table without primary key (off by
default)
--innodb-force-recovery=#
Helps to save your data in case the disk image of the
database becomes corrupt.
--innodb-foreground-preflush[=name]
Deprecated and ignored; only exists to allow easier
upgrade from earlier XtraDB versions.. One of:
SYNC_PREFLUSH, EXPONENTIAL_BACKOFF, DEPRECATED
--innodb-ft-aux-table=name
FTS internal auxiliary table to be checked
--innodb-ft-being-deleted[=name]
Enable or disable INNODB_FT_BEING_DELETED plugin. One of:
ON, OFF, FORCE (don't start if the plugin fails to load).
--innodb-ft-cache-size=#
InnoDB Fulltext search cache size in bytes
--innodb-ft-config[=name]
Enable or disable INNODB_FT_CONFIG plugin. One of: ON,
OFF, FORCE (don't start if the plugin fails to load).
--innodb-ft-default-stopword[=name]
Enable or disable INNODB_FT_DEFAULT_STOPWORD plugin. One
of: ON, OFF, FORCE (don't start if the plugin fails to
load).
--innodb-ft-deleted[=name]
Enable or disable INNODB_FT_DELETED plugin. One of: ON,
OFF, FORCE (don't start if the plugin fails to load).
--innodb-ft-enable-diag-print
Whether to enable additional FTS diagnostic printout
--innodb-ft-enable-stopword
Create FTS index with stopword.
(Defaults to on; use --skip-innodb-ft-enable-stopword to disable.)
--innodb-ft-index-cache[=name]
Enable or disable INNODB_FT_INDEX_CACHE plugin. One of:
ON, OFF, FORCE (don't start if the plugin fails to load).
--innodb-ft-index-table[=name]
Enable or disable INNODB_FT_INDEX_TABLE plugin. One of:
ON, OFF, FORCE (don't start if the plugin fails to load).
--innodb-ft-max-token-size=#
InnoDB Fulltext search maximum token size in characters
--innodb-ft-min-token-size=#
InnoDB Fulltext search minimum token size in characters
--innodb-ft-num-word-optimize[=#]
InnoDB Fulltext search number of words to optimize for
each optimize table call
--innodb-ft-result-cache-limit=#
InnoDB Fulltext search query result cache limit in bytes
--innodb-ft-server-stopword-table[=name]
The user supplied stopword table name.
--innodb-ft-sort-pll-degree=#
InnoDB Fulltext search parallel sort degree, will round
up to nearest power of number
--innodb-ft-total-cache-size=#
Total memory allocated for InnoDB Fulltext Search cache
--innodb-ft-user-stopword-table[=name]
User supplied stopword table name, effective in the
session level.
--innodb-idle-flush-pct=#
Up to what percentage of dirty pages should be flushed
when innodb finds it has spare resources to do so.
--innodb-immediate-scrub-data-uncompressed
Enable scrubbing of data
--innodb-instrument-semaphores
DEPRECATED. This setting has no effect.
--innodb-io-capacity=#
Number of IOPs the server can do. Tunes the background IO
rate
--innodb-io-capacity-max=#
Limit to which innodb_io_capacity can be inflated.
--innodb-kill-idle-transaction=#
No effect for this build.
--innodb-large-prefix
Support large index prefix length of
REC_VERSION_56_MAX_INDEX_COL_LEN () bytes.
(Defaults to on; use --skip-innodb-large-prefix to disable.)
--innodb-lock-schedule-algorithm=name
The algorithm Innodb uses for deciding which locks to
grant next when a lock is released. Possible values are
FCFS grant the locks in First-Come-First-Served order;
VATS use the Variance-Aware-Transaction-Scheduling
algorithm, which uses an Eldest-Transaction-First
heuristic.. One of: fcfs, vats
--innodb-lock-wait-timeout=#
Timeout in seconds an InnoDB transaction may wait for a
lock before being rolled back. Values above
disable the timeout.
--innodb-lock-waits[=name]
Enable or disable INNODB_LOCK_WAITS plugin. One of: ON,
OFF, FORCE (don't start if the plugin fails to load).
--innodb-locking-fake-changes
Deprecated and ignored; only exists to allow easier
upgrade from earlier XtraDB versions.
--innodb-locks[=name]
Enable or disable INNODB_LOCKS plugin. One of: ON, OFF,
FORCE (don't start if the plugin fails to load).
--innodb-locks-unsafe-for-binlog
DEPRECATED. This option may be removed in future
releases. Please use READ COMMITTED transaction isolation
level instead. Force InnoDB to not use next-key locking,
to use only row-level locking.
--innodb-log-arch-dir=name
Deprecated and ignored; only exists to allow easier
upgrade from earlier XtraDB versions.
--innodb-log-arch-expire-sec[=#]
Deprecated and ignored; only exists to allow easier
upgrade from earlier XtraDB versions.
--innodb-log-archive
Deprecated and ignored; only exists to allow easier
upgrade from earlier XtraDB versions.
--innodb-log-block-size=#
Deprecated and ignored; only exists to allow easier
upgrade from earlier XtraDB versions.
--innodb-log-buffer-size=#
The size of the buffer which InnoDB uses to write log to
the log files on disk.
--innodb-log-checksum-algorithm=name
Deprecated and translated to innodb_log_checksums (NONE
to OFF, everything else to ON); only exists to allow
easier upgrade from earlier XtraDB versions.. One of:
CRC32, STRICT_CRC32, INNODB, STRICT_INNODB, NONE,
STRICT_NONE, DEPRECATED
--innodb-log-checksums
Whether to compute and require checksums for InnoDB redo
log blocks
(Defaults to on; use --skip-innodb-log-checksums to disable.)
--innodb-log-compressed-pages
Enables/disables the logging of entire compressed page
images. InnoDB logs the compressed pages to prevent
corruption if the zlib compression algorithm changes.
When turned OFF, InnoDB will assume that the zlib
compression algorithm doesn't change.
(Defaults to on; use --skip-innodb-log-compressed-pages to disable.)
--innodb-log-file-size=#
Size of each log file in a log group.
--innodb-log-files-in-group=#
Number of log files in the log group. InnoDB writes to
the files in a circular fashion.
--innodb-log-group-home-dir=name
Path to InnoDB log files.
--innodb-log-optimize-ddl
Reduce redo logging when natively creating indexes or
rebuilding tables. Setting this OFF avoids delay due to
page flushing and allows concurrent backup.
(Defaults to on; use --skip-innodb-log-optimize-ddl to disable.)
--innodb-log-write-ahead-size=#
Redo log write ahead unit size to avoid read-on-write, it
should match the OS cache block IO size
--innodb-lru-scan-depth=#
How deep to scan LRU to keep it clean
--innodb-max-bitmap-file-size=#
Deprecated and ignored; only exists to allow easier
upgrade from earlier XtraDB versions.
--innodb-max-changed-pages=#
Deprecated and ignored; only exists to allow easier
upgrade from earlier XtraDB versions.
--innodb-max-dirty-pages-pct=#
Percentage of dirty pages allowed in bufferpool.
--innodb-max-dirty-pages-pct-lwm=#
Percentage of dirty pages at which flushing kicks in.
--innodb-max-purge-lag=#
Desired maximum length of the purge queue ( = no limit)
--innodb-max-purge-lag-delay=#
Maximum delay of user threads in micro-seconds
--innodb-max-undo-log-size[=#]
Desired maximum UNDO tablespace size in bytes
--innodb-metrics[=name]
Enable or disable INNODB_METRICS plugin. One of: ON, OFF,
FORCE (don't start if the plugin fails to load).
--innodb-mirrored-log-groups=#
Deprecated and ignored; only exists to allow easier
upgrade from earlier XtraDB versions.
--innodb-monitor-disable=name
Turn off a monitor counter
--innodb-monitor-enable=name
Turn on a monitor counter
--innodb-monitor-reset=name
Reset a monitor counter
--innodb-monitor-reset-all=name
Reset all values for a monitor counter
--innodb-mtflush-threads=#
DEPRECATED. Number of multi-threaded flush threads
--innodb-mutexes[=name]
Enable or disable INNODB_MUTEXES plugin. One of: ON, OFF,
FORCE (don't start if the plugin fails to load).
--innodb-old-blocks-pct=#
Percentage of the buffer pool to reserve for 'old'
blocks.
--innodb-old-blocks-time=#
Move blocks to the 'new' end of the buffer pool if the
first access was at least this many milliseconds ago. The
timeout is disabled if .
--innodb-online-alter-log-max-size=#
Maximum modification log file size for online index
creation
--innodb-open-files=#
How many files at the maximum InnoDB keeps open at the
same time.
--innodb-optimize-fulltext-only
Only optimize the Fulltext index of the table
--innodb-page-cleaners[=#]
Page cleaner threads can be from to . Default is .
--innodb-page-size[=#]
Page size to use for all InnoDB tablespaces.
--innodb-prefix-index-cluster-optimization
Enable prefix optimization to sometimes avoid cluster
index lookups.
--innodb-print-all-deadlocks
Print all deadlocks to MariaDB error log (off by default)
--innodb-purge-batch-size[=#]
Number of UNDO log pages to purge in one batch from the
history list.
--innodb-purge-rseg-truncate-frequency[=#]
Dictates rate at which UNDO records are purged. Value N
means purge rollback segment(s) on every Nth iteration of
purge invocation
--innodb-purge-threads[=#]
Purge threads can be from to . Default is .
--innodb-random-read-ahead
Whether to use read ahead for random access within an
extent.
--innodb-read-ahead-threshold=#
Number of pages that must be accessed sequentially for
InnoDB to trigger a readahead.
--innodb-read-io-threads=#
Number of background read I/O threads in InnoDB.
--innodb-read-only Start InnoDB in read only mode (off by default)
--innodb-replication-delay=#
Replication thread delay (ms) on the slave server if
innodb_thread_concurrency is reached ( by default)
--innodb-rollback-on-timeout
Roll back the complete transaction on lock wait timeout,
for .x compatibility (disabled by default)
--innodb-rollback-segments[=#]
Number of undo logs to use (deprecated).
--innodb-safe-truncate
Use backup-safe TRUNCATE TABLE and crash-safe RENAME
(incompatible with older MariaDB 10.2; ON by default)
(Defaults to on; use --skip-innodb-safe-truncate to disable.)
--innodb-sched-priority-cleaner=#
Deprecated and ignored; only exists to allow easier
upgrade from earlier XtraDB versions.
--innodb-scrub-log Enable background redo log (ib_logfile0, ib_logfile1...)
scrubbing
--innodb-scrub-log-speed[=#]
Background redo log scrubbing speed in bytes/sec
--innodb-show-locks-held=#
Deprecated and ignored; only exists to allow easier
upgrade from earlier XtraDB versions.
--innodb-show-verbose-locks=#
Deprecated and ignored; only exists to allow easier
upgrade from earlier XtraDB versions.
--innodb-sort-buffer-size=#
Memory buffer size for index creation
--innodb-spin-wait-delay[=#]
Maximum delay between polling for a spin lock ( by
default)
--innodb-stats-auto-recalc
InnoDB automatic recalculation of persistent statistics
enabled for all tables unless overridden at table level
(automatic recalculation is only done when InnoDB decides
that the table has changed too much and needs a new
statistics)
(Defaults to on; use --skip-innodb-stats-auto-recalc to disable.)
--innodb-stats-include-delete-marked
Include delete marked records when calculating persistent
statistics
--innodb-stats-method=name
Specifies how InnoDB index statistics collection code
should treat NULLs. Possible values are NULLS_EQUAL
(default), NULLS_UNEQUAL and NULLS_IGNORED. One of:
nulls_equal, nulls_unequal, nulls_ignored
--innodb-stats-modified-counter=#
The number of rows modified before we calculate new
statistics (default = current limits)
--innodb-stats-on-metadata
Enable statistics gathering for metadata commands such as
SHOW TABLE STATUS for tables that use transient
statistics (off by default)
--innodb-stats-persistent
InnoDB persistent statistics enabled for all tables
unless overridden at table level
(Defaults to on; use --skip-innodb-stats-persistent to disable.)
--innodb-stats-persistent-sample-pages=#
The number of leaf index pages to sample when calculating
persistent statistics (by ANALYZE, default )
--innodb-stats-sample-pages=#
Deprecated, use innodb_stats_transient_sample_pages
instead
--innodb-stats-traditional
Enable traditional statistic calculation based on number
of configured pages (default true)
(Defaults to on; use --skip-innodb-stats-traditional to disable.)
--innodb-stats-transient-sample-pages=#
The number of leaf index pages to sample when calculating
transient statistics (if persistent statistics are not
used, default )
--innodb-status-file
Enable SHOW ENGINE INNODB STATUS output in the
innodb_status.<pid> file
--innodb-status-output
Enable InnoDB monitor output to the error log.
--innodb-status-output-locks
Enable InnoDB lock monitor output to the error log.
Requires innodb_status_output=ON.
--innodb-strict-mode
Use strict mode when evaluating create options.
(Defaults to on; use --skip-innodb-strict-mode to disable.)
--innodb-support-xa Enable InnoDB support for the XA two-phase commit
(Defaults to on; use --skip-innodb-support-xa to disable.)
--innodb-sync-array-size[=#]
Size of the mutex/lock wait array.
--innodb-sync-spin-loops=#
Count of spin-loop rounds in InnoDB mutexes ( by
default)
--innodb-sys-columns[=name]
Enable or disable INNODB_SYS_COLUMNS plugin. One of: ON,
OFF, FORCE (don't start if the plugin fails to load).
--innodb-sys-datafiles[=name]
Enable or disable INNODB_SYS_DATAFILES plugin. One of:
ON, OFF, FORCE (don't start if the plugin fails to load).
--innodb-sys-fields[=name]
Enable or disable INNODB_SYS_FIELDS plugin. One of: ON,
OFF, FORCE (don't start if the plugin fails to load).
--innodb-sys-foreign[=name]
Enable or disable INNODB_SYS_FOREIGN plugin. One of: ON,
OFF, FORCE (don't start if the plugin fails to load).
--innodb-sys-foreign-cols[=name]
Enable or disable INNODB_SYS_FOREIGN_COLS plugin. One of:
ON, OFF, FORCE (don't start if the plugin fails to load).
--innodb-sys-indexes[=name]
Enable or disable INNODB_SYS_INDEXES plugin. One of: ON,
OFF, FORCE (don't start if the plugin fails to load).
--innodb-sys-semaphore-waits[=name]
Enable or disable INNODB_SYS_SEMAPHORE_WAITS plugin. One
of: ON, OFF, FORCE (don't start if the plugin fails to
load).
--innodb-sys-tables[=name]
Enable or disable INNODB_SYS_TABLES plugin. One of: ON,
OFF, FORCE (don't start if the plugin fails to load).
--innodb-sys-tablespaces[=name]
Enable or disable INNODB_SYS_TABLESPACES plugin. One of:
ON, OFF, FORCE (don't start if the plugin fails to load).
--innodb-sys-tablestats[=name]
Enable or disable INNODB_SYS_TABLESTATS plugin. One of:
ON, OFF, FORCE (don't start if the plugin fails to load).
--innodb-sys-virtual[=name]
Enable or disable INNODB_SYS_VIRTUAL plugin. One of: ON,
OFF, FORCE (don't start if the plugin fails to load).
--innodb-table-locks
Enable InnoDB locking in LOCK TABLES
(Defaults to on; use --skip-innodb-table-locks to disable.)
--innodb-tablespaces-encryption[=name]
Enable or disable INNODB_TABLESPACES_ENCRYPTION plugin.
One of: ON, OFF, FORCE (don't start if the plugin fails
to load).
--innodb-tablespaces-scrubbing[=name]
Enable or disable INNODB_TABLESPACES_SCRUBBING plugin.
One of: ON, OFF, FORCE (don't start if the plugin fails
to load).
--innodb-temp-data-file-path=name
Path to files and their sizes making temp-tablespace.
--innodb-thread-concurrency=#
Helps in performance tuning in heavily concurrent
environments. Sets the maximum number of threads allowed
inside InnoDB. Value will disable the thread
throttling.
--innodb-thread-sleep-delay=#
Time of innodb thread sleeping before joining InnoDB
queue (usec). Value disable a sleep
--innodb-tmpdir[=name]
Directory for temporary non-tablespace files.
--innodb-track-changed-pages
Deprecated and ignored; only exists to allow easier
upgrade from earlier XtraDB versions.
--innodb-track-redo-log-now
Deprecated and ignored; only exists to allow easier
upgrade from earlier XtraDB versions.
--innodb-trx[=name] Enable or disable INNODB_TRX plugin. One of: ON, OFF,
FORCE (don't start if the plugin fails to load).
--innodb-undo-directory=name
Directory where undo tablespace files live, this path can
be absolute.
--innodb-undo-log-truncate
Enable or Disable Truncate of UNDO tablespace.
--innodb-undo-logs[=#]
Number of undo logs to use.
--innodb-undo-tablespaces=#
Number of undo tablespaces to use.
--innodb-use-atomic-writes
Enable atomic writes, instead of using the doublewrite
buffer, for files on devices that supports atomic writes.
To use this option one must use file_per_table=,
flush_method=O_DIRECT and use_fallocate=. This option
only works on Linux with either FusionIO cards using the
directFS filesystem or with Shannon cards using any file
system.
(Defaults to on; use --skip-innodb-use-atomic-writes to disable.)
--innodb-use-fallocate
Use posix_fallocate() to allocate files. DEPRECATED, has
no effect.
--innodb-use-global-flush-log-at-trx-commit
Deprecated and ignored; only exists to allow easier
upgrade from earlier XtraDB versions.
--innodb-use-mtflush
DEPRECATED. Use multi-threaded flush. Default FALSE.
--innodb-use-native-aio
Use native AIO if supported on this platform.
(Defaults to on; use --skip-innodb-use-native-aio to disable.)
--innodb-use-stacktrace
Deprecated and ignored; only exists to allow easier
upgrade from earlier XtraDB versions.
--innodb-use-trim Deallocate (punch_hole|trim) unused portions of the page
compressed page (on by default)
(Defaults to on; use --skip-innodb-use-trim to disable.)
--innodb-write-io-threads=#
Number of background write I/O threads in InnoDB.
--interactive-timeout=#
The number of seconds the server waits for activity on an
interactive connection before closing it
--join-buffer-size=#
The size of the buffer that is used for joins
--join-buffer-space-limit=#
The limit of the space for all join buffers used by a
query
--join-cache-level=#
Controls what join operations can be executed with join
buffers. Odd numbers are used for plain join buffers
while even numbers are used for linked buffers
--keep-files-on-create
Don't overwrite stale .MYD and .MYI even if no directory
is specified
--key-buffer-size=# The size of the buffer used for index blocks for MyISAM
tables. Increase this to get better index handling (for
all reads and multiple writes) to as much as you can
afford
--key-cache-age-threshold=#
This characterizes the number of hits a hot block has to
be untouched until it is considered aged enough to be
downgraded to a warm block. This specifies the percentage
ratio of that number of hits to the total number of
blocks in key cache
--key-cache-block-size=#
The default size of key cache blocks
--key-cache-division-limit=#
The minimum percentage of warm blocks in key cache
--key-cache-file-hash-size=#
Number of hash buckets for open and changed files. If
you have a lot of MyISAM files open you should increase
this for faster flush of changes. A good value is
probably / of number of possible open MyISAM files.
--key-cache-segments=#
The number of segments in a key cache
-L, --language=name Client error messages in given language. May be given as
a full path. Deprecated. Use --lc-messages-dir instead.
--large-pages Enable support for large pages
--lc-messages=name Set the language used for the error messages.
-L, --lc-messages-dir=name
Directory where error messages are
--lc-time-names=name
Set the language used for the month names and the days of
the week.
--local-infile Enable LOAD DATA LOCAL INFILE
(Defaults to on; use --skip-local-infile to disable.)
--lock-wait-timeout=#
Timeout in seconds to wait for a lock before returning an
error.
--log-basename=name Basename for all log files and the .pid file. This sets
all log file names at once (in 'datadir') and is normally
the only option you need for specifying log files. Sets
names for --log-bin, --log-bin-index, --relay-log,
--relay-log-index, --general-log-file,
--log-slow-query-log-file, --log-error-file, and
--pid-file
--log-bin[=name] Log update queries in binary format. Optional argument
should be name for binary log. If not given
'datadir'/'log-basename'-bin or 'datadir'/mysql-bin will
be used (the later if --log-basename is not specified).
We strongly recommend to use either --log-basename or
specify a filename to ensure that replication doesn't
stop if the real hostname of the computer changes.
--log-bin-compress Whether the binary log can be compressed
--log-bin-compress-min-len[=#]
Minimum length of sql statement(in statement mode) or
record(in row mode)that can be compressed.
--log-bin-index=name
File that holds the names for last binary log files.
--log-bin-trust-function-creators
If set to FALSE (the default), then when --log-bin is
used, creation of a stored function (or trigger) is
allowed only to users having the SUPER privilege and only
if this stored function (trigger) may not break binary
logging. Note that if ALL connections to this server
ALWAYS use row-based binary logging, the security issues
do not exist and the binary logging cannot break, so you
can safely set this to TRUE
--log-error[=name] Log errors to file (instead of stdout). If file name is
not specified then 'datadir'/'log-basename'.err or the
'pid-file' path with extension .err is used
--log-isam[=name] Log all MyISAM changes to file.
--log-output=name How logs should be written. Any combination of: NONE,
FILE, TABLE
--log-queries-not-using-indexes
Log queries that are executed without benefit of any
index to the slow log if it is open
--log-short-format Don't log extra information to update and slow-query
logs.
--log-slave-updates Tells the slave to log the updates from the slave thread
to the binary log. You will need to turn it on if you
plan to daisy-chain the slaves.
--log-slow-admin-statements
Log slow OPTIMIZE, ANALYZE, ALTER and other
administrative statements to the slow log if it is open.
(Defaults to on; use --skip-log-slow-admin-statements to disable.)
--log-slow-filter=name
Log only certain types of queries. Any combination of:
admin, filesort, filesort_on_disk, full_join, full_scan,
query_cache, query_cache_miss, tmp_table,
tmp_table_on_disk
--log-slow-rate-limit=#
Write to slow log every #th slow query. Set to to log
everything. Increase it to reduce the size of the slow or
the performance impact of slow logging
--log-slow-slave-statements
Log slow statements executed by slave thread to the slow
log if it is open.
(Defaults to on; use --skip-log-slow-slave-statements to disable.)
--log-slow-verbosity=name
Verbosity level for the slow log. Any combination of:
innodb, query_plan, explain
--log-tc=name Path to transaction coordinator log (used for
transactions that affect more than one storage engine,
when binary log is disabled).
--log-tc-size=# Size of transaction coordinator log.
-W, --log-warnings[=#]
Log some not critical warnings to the general log
file.Value can be between and . Higher values mean
more verbosity
--long-query-time=# Log all queries that have taken more than long_query_time
seconds to execute to the slow query log file. The
argument will be treated as a decimal value with
microsecond precision
--low-priority-updates
INSERT/DELETE/UPDATE has lower priority than selects
--lower-case-table-names[=#]
If set to table names are stored in lowercase on disk
and table names will be case-insensitive. Should be set
to if you are using a case insensitive file system
--master-info-file=name
The location and name of the file that remembers the
master and where the I/O replication thread is in the
master's binlogs. Defaults to master.info
--master-retry-count=#
The number of tries the slave will make to connect to the
master before giving up.
--master-verify-checksum
Force checksum verification of logged events in the
binary log before sending them to slaves or printing them
in the output of SHOW BINLOG EVENTS
--max-allowed-packet=#
Max packet length to send to or receive from the server
--max-binlog-cache-size=#
Sets the total size of the transactional cache
--max-binlog-size=# Binary log will be rotated automatically when the size
exceeds this value.
--max-binlog-stmt-cache-size=#
Sets the total size of the statement cache
--max-connect-errors=#
If there is more than this number of interrupted
connections from a host this host will be blocked from
further connections
--max-connections=# The number of simultaneous clients allowed
--max-delayed-threads=#
Don't start more than this number of threads to handle
INSERT DELAYED statements. If set to zero INSERT DELAYED
will be not used
--max-digest-length=#
Maximum length considered for digest text.
--max-error-count=# Max number of errors/warnings to store for a statement
--max-heap-table-size=#
Don't allow creation of heap tables bigger than this
--max-join-size=# Joins that are probably going to read more than
max_join_size records return an error
--max-length-for-sort-data=#
Max number of bytes in sorted records
--max-long-data-size=#
The maximum BLOB length to send to server from
mysql_send_long_data API. Deprecated option; use
max_allowed_packet instead.
--max-prepared-stmt-count=#
Maximum number of prepared statements in the server
--max-recursive-iterations[=#]
Maximum number of iterations when executing recursive
queries
--max-relay-log-size=#
relay log will be rotated automatically when the size
exceeds this value. If at startup, it's set to
max_binlog_size
--max-seeks-for-key=#
Limit assumed max number of seeks when looking up rows
based on a key
--max-session-mem-used=#
Amount of memory a single user session is allowed to
allocate. This limits the value of the session variable
MEM_USED
--max-sort-length=# The number of bytes to use when sorting BLOB or TEXT
values (only the first max_sort_length bytes of each
value are used; the rest are ignored)
--max-sp-recursion-depth[=#]
Maximum stored procedure recursion depth
--max-statement-time=#
A query that has taken more than max_statement_time
seconds will be aborted. The argument will be treated as
a decimal value with microsecond precision. A value of
(default) means no timeout
--max-tmp-tables=# Unused, will be removed.
--max-user-connections=#
The maximum number of active connections for a single
user ( = no limit)
--max-write-lock-count=#
After this many write locks, allow some read locks to run
in between
--memlock Lock mysqld in memory.
--metadata-locks-cache-size=#
Unused
--metadata-locks-hash-instances=#
Unused
--min-examined-row-limit=#
Don't write queries to slow log that examine fewer rows
than that
--mrr-buffer-size=# Size of buffer to use when using MRR with range access
--multi-range-count=#
Ignored. Use mrr_buffer_size instead
--myisam-block-size=#
Block size to be used for MyISAM index pages
--myisam-data-pointer-size=#
Default pointer size to be used for MyISAM tables
--myisam-max-sort-file-size=#
Don't use the fast sort index method to created index if
the temporary file would get bigger than this
--myisam-mmap-size=#
Restricts the total memory used for memory mapping of
MySQL tables
--myisam-recover-options[=name]
Specifies how corrupted tables should be automatically
repaired. Any combination of: DEFAULT, BACKUP, FORCE,
QUICK, BACKUP_ALL, OFF
--myisam-repair-threads=#
If larger than , when repairing a MyISAM table all
indexes will be created in parallel, with one thread per
index. The value of disables parallel repair
--myisam-sort-buffer-size=#
The buffer that is allocated when sorting the index when
doing a REPAIR or when creating indexes with CREATE INDEX
or ALTER TABLE
--myisam-stats-method=name
Specifies how MyISAM index statistics collection code
should treat NULLs. Possible values of name are
NULLS_UNEQUAL (default behavior for 4.1 and later),
NULLS_EQUAL (emulate 4.0 behavior), and NULLS_IGNORED
--myisam-use-mmap Use memory mapping for reading and writing MyISAM tables
--mysql56-temporal-format
Use MySQL-5.6 (instead of MariaDB-5.3) format for TIME,
DATETIME, TIMESTAMP columns.
(Defaults to on; use --skip-mysql56-temporal-format to disable.)
--net-buffer-length=#
Buffer length for TCP/IP and socket communication
--net-read-timeout=#
Number of seconds to wait for more data from a connection
before aborting the read
--net-retry-count=# If a read on a communication port is interrupted, retry
this many times before giving up
--net-write-timeout=#
Number of seconds to wait for a block to be written to a
connection before aborting the write
--old Use compatible behavior from previous MariaDB version.
See also --old-mode
--old-alter-table Use old, non-optimized alter table
--old-mode=name Used to emulate old behavior from earlier MariaDB or
MySQL versions. Any combination of:
NO_DUP_KEY_WARNINGS_WITH_IGNORE, NO_PROGRESS_INFO,
ZERO_DATE_TIME_CAST
--old-passwords Use old password encryption method (needed for 4.0 and
older clients)
--old-style-user-limits
Enable old-style user limits (before 5.0., user
resources were counted per each user+host vs. per
account).
--open-files-limit=#
If this is not , then mysqld will use this value to
reserve file descriptors to use with setrlimit(). If this
value is or autoset then mysqld will reserve
max_connections* or max_connections + table_cache*
(whichever is larger) number of file descriptors
(Automatically configured unless set explicitly)
--optimizer-prune-level=#
Controls the heuristic(s) applied during query
optimization to prune less-promising partial plans from
the optimizer search space. Meaning: - do not apply any
heuristic, thus perform exhaustive search; - prune
plans based on number of retrieved rows
--optimizer-search-depth=#
Maximum depth of search performed by the query optimizer.
Values larger than the number of relations in a query
result in better query plans, but take longer to compile
a query. Values smaller than the number of tables in a
relation result in faster optimization, but may produce
very bad query plans. If set to , the system will
automatically pick a reasonable value.
--optimizer-selectivity-sampling-limit=#
Controls number of record samples to check condition
selectivity
--optimizer-switch=name
Fine-tune the optimizer behavior. Takes a comma-separated
list of option=value pairs, where value is on, off, or
default, and options are: index_merge, index_merge_union,
index_merge_sort_union, index_merge_intersection,
index_merge_sort_intersection, engine_condition_pushdown,
index_condition_pushdown, derived_merge,
derived_with_keys, firstmatch, loosescan, materialization,
in_to_exists, semijoin, partial_match_rowid_merge,
partial_match_table_scan, subquery_cache, mrr,
mrr_cost_based, mrr_sort_keys, outer_join_with_cache,
semijoin_with_cache, join_cache_incremental,
join_cache_hashed, join_cache_bka,
optimize_join_buffer_size, table_elimination,
extended_keys, exists_to_in, orderby_uses_equalities,
condition_pushdown_for_derived
--optimizer-use-condition-selectivity=#
Controls selectivity of which conditions the optimizer
takes into account to calculate cardinality of a partial
join when it searches for the best execution plan
Meaning: - use selectivity of index backed range
conditions to calculate the cardinality of a partial join
if the last joined table is accessed by full table scan
or an index scan, - use selectivity of index backed
range conditions to calculate the cardinality of a
partial join in any case, - additionally always use
selectivity of range conditions that are not backed by
any index to calculate the cardinality of a partial join,
- use histograms to calculate selectivity of range
conditions that are not backed by any index to calculate
the cardinality of a partial join. - additionally use
selectivity of certain non-range predicates calculated on
record samples
--partition[=name] Enable or disable partition plugin. One of: ON, OFF,
FORCE (don't start if the plugin fails to load).
--performance-schema
Enable the performance schema.
--performance-schema-accounts-size=#
Maximum number of instrumented user@host accounts. Use
to disable, - for automated sizing.
--performance-schema-consumer-events-stages-current
Default startup value for the events_stages_current
consumer.
--performance-schema-consumer-events-stages-history
Default startup value for the events_stages_history
consumer.
--performance-schema-consumer-events-stages-history-long
Default startup value for the events_stages_history_long
consumer.
--performance-schema-consumer-events-statements-current
Default startup value for the events_statements_current
consumer.
(Defaults to on; use --skip-performance-schema-consumer-events-statements-current to disable.)
--performance-schema-consumer-events-statements-history
Default startup value for the events_statements_history
consumer.
--performance-schema-consumer-events-statements-history-long
Default startup value for the
events_statements_history_long consumer.
--performance-schema-consumer-events-waits-current
Default startup value for the events_waits_current
consumer.
--performance-schema-consumer-events-waits-history
Default startup value for the events_waits_history
consumer.
--performance-schema-consumer-events-waits-history-long
Default startup value for the events_waits_history_long
consumer.
--performance-schema-consumer-global-instrumentation
Default startup value for the global_instrumentation
consumer.
(Defaults to on; use --skip-performance-schema-consumer-global-instrumentation to disable.)
--performance-schema-consumer-statements-digest
Default startup value for the statements_digest consumer.
(Defaults to on; use --skip-performance-schema-consumer-statements-digest to disable.)
--performance-schema-consumer-thread-instrumentation
Default startup value for the thread_instrumentation
consumer.
(Defaults to on; use --skip-performance-schema-consumer-thread-instrumentation to disable.)
--performance-schema-digests-size=#
Size of the statement digest. Use to disable, - for
automated sizing.
--performance-schema-events-stages-history-long-size=#
Number of rows in EVENTS_STAGES_HISTORY_LONG. Use to
disable, - for automated sizing.
--performance-schema-events-stages-history-size=#
Number of rows per thread in EVENTS_STAGES_HISTORY. Use
to disable, - for automated sizing.
--performance-schema-events-statements-history-long-size=#
Number of rows in EVENTS_STATEMENTS_HISTORY_LONG. Use
to disable, - for automated sizing.
--performance-schema-events-statements-history-size=#
Number of rows per thread in EVENTS_STATEMENTS_HISTORY.
Use to disable, - for automated sizing.
--performance-schema-events-waits-history-long-size=#
Number of rows in EVENTS_WAITS_HISTORY_LONG. Use to
disable, - for automated sizing.
--performance-schema-events-waits-history-size=#
Number of rows per thread in EVENTS_WAITS_HISTORY. Use
to disable, - for automated sizing.
--performance-schema-hosts-size=#
Maximum number of instrumented hosts. Use to disable,
- for automated sizing.
--performance-schema-instrument[=name]
Default startup value for a performance schema
instrument.
--performance-schema-max-cond-classes=#
Maximum number of condition instruments.
--performance-schema-max-cond-instances=#
Maximum number of instrumented condition objects. Use
to disable, - for automated sizing.
--performance-schema-max-digest-length=#
Maximum length considered for digest text, when stored in
performance_schema tables.
--performance-schema-max-file-classes=#
Maximum number of file instruments.
--performance-schema-max-file-handles=#
Maximum number of opened instrumented files.
--performance-schema-max-file-instances=#
Maximum number of instrumented files. Use to disable,
- for automated sizing.
--performance-schema-max-mutex-classes=#
Maximum number of mutex instruments.
--performance-schema-max-mutex-instances=#
Maximum number of instrumented MUTEX objects. Use to
disable, - for automated sizing.
--performance-schema-max-rwlock-classes=#
Maximum number of rwlock instruments.
--performance-schema-max-rwlock-instances=#
Maximum number of instrumented RWLOCK objects. Use to
disable, - for automated sizing.
--performance-schema-max-socket-classes=#
Maximum number of socket instruments.
--performance-schema-max-socket-instances=#
Maximum number of opened instrumented sockets. Use to
disable, - for automated sizing.
--performance-schema-max-stage-classes=#
Maximum number of stage instruments.
--performance-schema-max-statement-classes=#
Maximum number of statement instruments.
--performance-schema-max-table-handles=#
Maximum number of opened instrumented tables. Use to
disable, - for automated sizing.
--performance-schema-max-table-instances=#
Maximum number of instrumented tables. Use to disable,
- for automated sizing.
--performance-schema-max-thread-classes=#
Maximum number of thread instruments.
--performance-schema-max-thread-instances=#
Maximum number of instrumented threads. Use to disable,
- for automated sizing.
--performance-schema-session-connect-attrs-size=#
Size of session attribute string buffer per thread. Use
to disable, - for automated sizing.
--performance-schema-setup-actors-size=#
Maximum number of rows in SETUP_ACTORS.
--performance-schema-setup-objects-size=#
Maximum number of rows in SETUP_OBJECTS.
--performance-schema-users-size=#
Maximum number of instrumented users. Use to disable,
- for automated sizing.
--pid-file=name Pid file used by safe_mysqld
--plugin-dir=name Directory for plugins
--plugin-load=name Semicolon-separated list of plugins to load, where each
plugin is specified as ether a plugin_name=library_file
pair or only a library_file. If the latter case, all
plugins from a given library_file will be loaded.
--plugin-load-add=name
Optional semicolon-separated list of plugins to load.
This option adds to the list specified by --plugin-load
in an incremental way. It can be specified many times,
adding more plugins every time.
--plugin-maturity=name
The lowest desirable plugin maturity. Plugins less mature
than that will not be installed or loaded. One of:
unknown, experimental, alpha, beta, gamma, stable
-P, --port=# Port number to use for connection or to default to,
my.cnf, $MYSQL_TCP_PORT, /etc/services, built-in default
(), whatever comes first
--port-open-timeout=#
Maximum time in seconds to wait for the port to become
free. (Default: No wait).
--preload-buffer-size=#
The size of the buffer that is allocated when preloading
indexes
--profiling-history-size=#
Number of statements about which profiling information is
maintained. If set to , no profiles are stored. See SHOW
PROFILES.
--progress-report-time=#
Seconds between sending progress reports to the client
for time-consuming statements. Set to to disable
progress reporting.
--query-alloc-block-size=#
Allocation block size for query parsing and execution
--query-cache-limit=#
Don't cache results that are bigger than this
--query-cache-min-res-unit=#
The minimum size for blocks allocated by the query cache
--query-cache-size=#
The memory allocated to store results from old queries
--query-cache-strip-comments
Strip all comments from a query before storing it in the
query cache
--query-cache-type=name
OFF = Don't cache or retrieve results. ON = Cache all
results except SELECT SQL_NO_CACHE ... queries. DEMAND =
Cache only SELECT SQL_CACHE ... queries
--query-cache-wlock-invalidate
Invalidate queries in query cache on LOCK for write
--query-prealloc-size=#
Persistent buffer for query parsing and execution
--range-alloc-block-size=#
Allocation block size for storing ranges during
optimization
--read-binlog-speed-limit=#
Maximum speed(KB/s) to read binlog from master ( = no
limit)
--read-buffer-size=#
Each thread that does a sequential scan allocates a
buffer of this size for each table it scans. If you do
many sequential scans, you may want to increase this
value
--read-only Make all non-temporary tables read-only, with the
exception for replication (slave) threads and users with
the SUPER privilege
--read-rnd-buffer-size=#
When reading rows in sorted order after a sort, the rows
are read through this buffer to avoid a disk seeks
--relay-log=name The location and name to use for relay logs.
--relay-log-index=name
The location and name to use for the file that keeps a
list of the last relay logs
--relay-log-info-file=name
The location and name of the file that remembers where
the SQL replication thread is in the relay logs.
--relay-log-purge if disabled - do not purge relay logs. if enabled - purge
them as soon as they are no more needed.
(Defaults to on; use --skip-relay-log-purge to disable.)
--relay-log-recovery
Enables automatic relay log recovery right after the
database startup, which means that the IO Thread starts
re-fetching from the master right after the last
transaction processed.
--relay-log-space-limit=#
Maximum space to use for all relay logs
--replicate-annotate-row-events
Tells the slave to write annotate rows events received
from the master to its own binary log. Ignored if
log_slave_updates is not set
(Defaults to on; use --skip-replicate-annotate-row-events to disable.)
--replicate-do-db=name
Tells the slave thread to restrict replication to the
specified database. To specify more than one database,
use the directive multiple times, once for each database.
Note that this will only work if you do not use
cross-database queries such as UPDATE some_db.some_table
SET foo='bar' while having selected a different or no
database. If you need cross database updates to work,
make sure you have 3.23. or later, and use
replicate-wild-do-table=db_name.%.
--replicate-do-table=name
Tells the slave thread to restrict replication to the
specified table. To specify more than one table, use the
directive multiple times, once for each table. This will
work for cross-database updates, in contrast to
replicate-do-db.
--replicate-events-marked-for-skip=name
Whether the slave should replicate events that were
created with @@skip_replication= on the master. Default
REPLICATE (no events are skipped). Other values are
FILTER_ON_SLAVE (events will be sent by the master but
ignored by the slave) and FILTER_ON_MASTER (events marked
with @@skip_replication= will be filtered on the master
and never be sent to the slave).
--replicate-ignore-db=name
Tells the slave thread to not replicate to the specified
database. To specify more than one database to ignore,
use the directive multiple times, once for each database.
This option will not work if you use cross database
updates. If you need cross database updates to work, make
sure you have 3.23. or later, and use
replicate-wild-ignore-table=db_name.%.
--replicate-ignore-table=name
Tells the slave thread to not replicate to the specified
table. To specify more than one table to ignore, use the
directive multiple times, once for each table. This will
work for cross-database updates, in contrast to
replicate-ignore-db.
--replicate-rewrite-db=name
Updates to a database with a different name than the
original. Example:
replicate-rewrite-db=master_db_name->slave_db_name.
--replicate-same-server-id
In replication, if set to , do not skip events having
our server id. Default value is (to break infinite
loops in circular replication). Can't be set to 1 if
--log-slave-updates is used.
--replicate-wild-do-table=name
Tells the slave thread to restrict replication to the
tables that match the specified wildcard pattern. To
specify more than one table, use the directive multiple
times, once for each table. This will work for
cross-database updates. Example:
replicate-wild-do-table=foo%.bar% will replicate only
updates to tables in all databases that start with foo
and whose table names start with bar.
--replicate-wild-ignore-table=name
Tells the slave thread to not replicate to the tables
that match the given wildcard pattern. To specify more
than one table to ignore, use the directive multiple
times, once for each table. This will work for
cross-database updates. Example:
replicate-wild-ignore-table=foo%.bar% will not do updates
to tables in databases that start with foo and whose
table names start with bar.
--report-host=name Hostname or IP of the slave to be reported to the master
during slave registration. Will appear in the output of
SHOW SLAVE HOSTS. Leave unset if you do not want the
slave to register itself with the master. Note that it is
not sufficient for the master to simply read the IP of
the slave off the socket once the slave connects. Due to
NAT and other routing issues, that IP may not be valid
for connecting to the slave from the master or other
hosts
--report-password=name
The account password of the slave to be reported to the
master during slave registration
--report-port=# Port for connecting to slave reported to the master
during slave registration. Set it only if the slave is
listening on a non-default port or if you have a special
tunnel from the master or other clients to the slave. If
not sure, leave this option unset
--report-user=name The account user name of the slave to be reported to the
master during slave registration
--rowid-merge-buff-size=#
The size of the buffers used [NOT] IN evaluation via
partial matching
--safe-mode Skip some optimize stages (for testing). Deprecated.
--safe-user-create Don't allow new user creation by the user who has no
write privileges to the mysql.user table.
--secure-auth Disallow authentication for accounts that have old
(pre-4.1) passwords
(Defaults to on; use --skip-secure-auth to disable.)
--secure-file-priv=name
Limit LOAD DATA, SELECT ... OUTFILE, and LOAD_FILE() to
files within specified directory
--sequence[=name] Enable or disable SEQUENCE plugin. One of: ON, OFF, FORCE
(don't start if the plugin fails to load).
--server-id=# Uniquely identifies the server instance in the community
of replication partners
--session-track-schema
Track changes to the default schema.
(Defaults to on; use --skip-session-track-schema to disable.)
--session-track-state-change
Track changes to the session state.
--session-track-system-variables=name
Track changes in registered system variables. For
compatibility with MySQL defaults this variable should be
set to "autocommit, character_set_client,
character_set_connection, character_set_results,
time_zone"
--session-track-transaction-info=name
Track changes to the transaction attributes. OFF to
disable; STATE to track just transaction state (Is there
an active transaction? Does it have any data? etc.);
CHARACTERISTICS to track transaction state and report all
statements needed to start a transaction withthe same
characteristics (isolation level, read only/read
write,snapshot - but not any work done / data modified
within the transaction).
--show-slave-auth-info
Show user and password in SHOW SLAVE HOSTS on this
master.
--silent-startup Don't print [Note] to the error log during startup.
--skip-bdb Deprecated option; Exist only for compatibility with old
my.cnf files
--skip-grant-tables Start without grant tables. This gives all users FULL
ACCESS to all tables.
--skip-host-cache Don't cache host names.
--skip-name-resolve Don't resolve hostnames. All hostnames are IP's or
'localhost'.
--skip-networking Don't allow connection with TCP/IP
--skip-show-database
Don't allow 'SHOW DATABASE' commands
--skip-slave-start If set, slave is not autostarted.
--slave-compressed-protocol
Use compression on master/slave protocol
--slave-ddl-exec-mode=name
How replication events should be executed. Legal values
are STRICT and IDEMPOTENT (default). In IDEMPOTENT mode,
replication will not stop for DDL operations that are
idempotent. This means that CREATE TABLE is treated as
CREATE TABLE OR REPLACE and DROP TABLE is treated as DROP
TABLE IF EXISTS.
--slave-domain-parallel-threads=#
Maximum number of parallel threads to use on slave for
events in a single replication domain. When using
multiple domains, this can be used to limit a single
domain from grabbing all threads and thus stalling other
domains. The default of means to allow a domain to grab
as many threads as it wants, up to the value of
slave_parallel_threads.
--slave-exec-mode=name
How replication events should be executed. Legal values
are STRICT (default) and IDEMPOTENT. In IDEMPOTENT mode,
replication will not stop for operations that are
idempotent. For example, in row based replication
attempts to delete rows that doesn't exist will be
ignored. In STRICT mode, replication will stop on any
unexpected difference between the master and the slave.
--slave-load-tmpdir=name
The location where the slave should put its temporary
files when replicating a LOAD DATA INFILE command
--slave-max-allowed-packet=#
The maximum packet length to sent successfully from the
master to slave.
--slave-net-timeout=#
Number of seconds to wait for more data from any
master/slave connection before aborting the read
--slave-parallel-max-queued=#
Limit on how much memory SQL threads should use per
parallel replication thread when reading ahead in the
relay log looking for opportunities for parallel
replication. Only used when --slave-parallel-threads > .
--slave-parallel-mode=name
Controls what transactions are applied in parallel when
using --slave-parallel-threads. Possible values:
"optimistic" tries to apply most transactional DML in
parallel, and handles any conflicts with rollback and
retry. "conservative" limits parallelism in an effort to
avoid any conflicts. "aggressive" tries to maximise the
parallelism, possibly at the cost of increased conflict
rate. "minimal" only parallelizes the commit steps of
transactions. "none" disables parallel apply completely.
--slave-parallel-threads=#
If non-zero, number of threads to spawn to apply in
parallel events on the slave that were group-committed on
the master or were logged with GTID in different
replication domains. Note that these threads are in
addition to the IO and SQL threads, which are always
created by a replication slave
--slave-parallel-workers=#
Alias for slave_parallel_threads
--slave-run-triggers-for-rbr=name
Modes for how triggers in row-base replication on slave
side will be executed. Legal values are NO (default), YES
and LOGGING. NO means that trigger for RBR will not be
running on slave. YES and LOGGING means that triggers
will be running on slave, if there was not triggers
running on the master for the statement. LOGGING also
means results of that the executed triggers work will be
written to the binlog.
--slave-skip-errors=name
Tells the slave thread to continue replication when a
query event returns an error from the provided list
--slave-sql-verify-checksum
Force checksum verification of replication events after
reading them from relay log. Note: Events are always
checksum-verified by slave on receiving them from the
network before writing them to the relay log
(Defaults to on; use --skip-slave-sql-verify-checksum to disable.)
--slave-transaction-retries=#
Number of times the slave SQL thread will retry a
transaction in case it failed with a deadlock or elapsed
lock wait timeout, before giving up and stopping
--slave-type-conversions=name
Set of slave type conversions that are enabled. If the
variable is empty, no conversions are allowed and it is
expected that the types match exactly. Any combination
of: ALL_LOSSY, ALL_NON_LOSSY
--slow-launch-time=#
If creating the thread takes longer than this value (in
seconds), the Slow_launch_threads counter will be
incremented
--slow-query-log Log slow queries to a table or log file. Defaults logging
to a file 'hostname'-slow.log or a table mysql.slow_log
if --log-output=TABLE is used. Must be enabled to
activate other slow log options.
--slow-query-log-file=name
Log slow queries to given log file. Defaults logging to
'hostname'-slow.log. Must be enabled to activate other
slow log options
--socket=name Socket file to use for connection
--sort-buffer-size=#
Each thread that needs to do a sort allocates a buffer of
this size
--sql-mode=name Sets the sql mode. Any combination of: REAL_AS_FLOAT,
PIPES_AS_CONCAT, ANSI_QUOTES, IGNORE_SPACE,
IGNORE_BAD_TABLE_OPTIONS, ONLY_FULL_GROUP_BY,
NO_UNSIGNED_SUBTRACTION, NO_DIR_IN_CREATE, POSTGRESQL,
ORACLE, MSSQL, DB2, MAXDB, NO_KEY_OPTIONS,
NO_TABLE_OPTIONS, NO_FIELD_OPTIONS, MYSQL323, MYSQL40,
ANSI, NO_AUTO_VALUE_ON_ZERO, NO_BACKSLASH_ESCAPES,
STRICT_TRANS_TABLES, STRICT_ALL_TABLES, NO_ZERO_IN_DATE,
NO_ZERO_DATE, ALLOW_INVALID_DATES,
ERROR_FOR_DIVISION_BY_ZERO, TRADITIONAL,
NO_AUTO_CREATE_USER, HIGH_NOT_PRECEDENCE,
NO_ENGINE_SUBSTITUTION, PAD_CHAR_TO_FULL_LENGTH
--ssl Enable SSL for connection (automatically enabled if an
ssl option is used).
--ssl-ca=name CA file in PEM format (check OpenSSL docs, implies --ssl)
--ssl-capath=name CA directory (check OpenSSL docs, implies --ssl)
--ssl-cert=name X509 cert in PEM format (implies --ssl)
--ssl-cipher=name SSL cipher to use (implies --ssl)
--ssl-crl=name CRL file in PEM format (check OpenSSL docs, implies
--ssl)
--ssl-crlpath=name CRL directory (check OpenSSL docs, implies --ssl)
--ssl-key=name X509 key in PEM format (implies --ssl)
--stack-trace Print a symbolic stack trace on failure
(Defaults to on; use --skip-stack-trace to disable.)
--standard-compliant-cte
Allow only CTEs compliant to SQL standard
(Defaults to on; use --skip-standard-compliant-cte to disable.)
--stored-program-cache=#
The soft upper limit for number of cached stored routines
for one connection.
--strict-password-validation
When password validation plugins are enabled, reject
passwords that cannot be validated (passwords specified
as a hash)
(Defaults to on; use --skip-strict-password-validation to disable.)
--super-large-pages Enable support for super large pages.
-s, --symbolic-links
Enable symbolic link support.
(Defaults to on; use --skip-symbolic-links to disable.)
--sync-binlog=# Synchronously flush binary log to disk after every #th
event. Use (default) to disable synchronous flushing
--sync-frm Sync .frm files to disk on creation
(Defaults to on; use --skip-sync-frm to disable.)
--sync-master-info=#
Synchronously flush master info to disk after every #th
event. Use to disable synchronous flushing
--sync-relay-log=# Synchronously flush relay log to disk after every #th
event. Use to disable synchronous flushing
--sync-relay-log-info=#
Synchronously flush relay log info to disk after every
#th transaction. Use to disable synchronous flushing
--sysdate-is-now Non-default option to alias SYSDATE() to NOW() to make it
safe-replicable. Since 5.0, SYSDATE() returns a `dynamic'
value different for different invocations, even within
the same statement.
--table-cache=# Deprecated; use --table-open-cache instead.
--table-definition-cache=#
The number of cached table definitions
--table-open-cache=#
The number of cached open tables
--table-open-cache-instances=#
Maximum number of table cache instances
--tc-heuristic-recover=name
Decision to use in heuristic recover process. One of: OFF,
COMMIT, ROLLBACK
--temp-pool Using this option will cause most temporary files created
to use a small set of names, rather than a unique name
for each new file.
(Defaults to on; use --skip-temp-pool to disable.)
--thread-cache-size=#
How many threads we should keep in a cache for reuse.
These are freed after minutes of idle time
--thread-concurrency=#
Permits the application to give the threads system a hint
for the desired number of threads that should be run at
the same time.This variable has no effect, and is
deprecated. It will be removed in a future release.
--thread-handling=name
Define threads usage for handling queries. One of:
one-thread-per-connection, no-threads, pool-of-threads
--thread-pool-idle-timeout=#
Timeout in seconds for an idle thread in the thread
pool.Worker thread will be shut down after timeout
--thread-pool-max-threads=#
Maximum allowed number of worker threads in the thread
pool
--thread-pool-oversubscribe=#
How many additional active worker threads in a group are
allowed.
--thread-pool-prio-kickup-timer=#
The number of milliseconds before a dequeued low-priority
statement is moved to the high-priority queue
--thread-pool-priority=name
Threadpool priority. High priority connections usually
start executing earlier than low priority.If priority set
to 'auto', the the actual priority(low or high) is
determined based on whether or not connection is inside
transaction.
--thread-pool-size=#
Number of thread groups in the pool. This parameter is
roughly equivalent to maximum number of concurrently
executing threads (threads in a waiting state do not
count as executing).
--thread-pool-stall-limit=#
Maximum query execution time in milliseconds,before an
executing non-yielding thread is considered stalled.If a
worker thread is stalled, additional worker thread may be
created to handle remaining clients.
--thread-stack=# The stack size for each thread
--time-format=name The TIME format (ignored)
--timed-mutexes Specify whether to time mutexes. Deprecated, has no
effect.
--tmp-disk-table-size=#
Max size for data for an internal temporary on-disk
MyISAM or Aria table.
--tmp-memory-table-size=#
If an internal in-memory temporary table exceeds this
size, MariaDB will automatically convert it to an on-disk
MyISAM or Aria table. Same as tmp_table_size.
--tmp-table-size=# Alias for tmp_memory_table_size. If an internal in-memory
temporary table exceeds this size, MariaDB will
automatically convert it to an on-disk MyISAM or Aria
table.
-t, --tmpdir=name Path for temporary files. Several paths may be specified,
separated by a colon (:), in this case they are used in a
round-robin fashion
--transaction-alloc-block-size=#
Allocation block size for transactions to be stored in
binary log
--transaction-isolation=name
Default transaction isolation level. One of:
READ-UNCOMMITTED, READ-COMMITTED, REPEATABLE-READ,
SERIALIZABLE
--transaction-prealloc-size=#
Persistent buffer for transactions to be stored in binary
log
--transaction-read-only
Default transaction access mode. True if transactions are
read-only.
--updatable-views-with-limit=name
YES = Don't issue an error message (warning only) if a
VIEW without presence of a key of the underlying table is
used in queries with a LIMIT clause for updating. NO =
Prohibit update of a VIEW, which does not contain a key
of the underlying table and the query uses a LIMIT clause
(usually get from GUI tools)
--use-stat-tables=name
Specifies how to use system statistics tables. One of:
NEVER, COMPLEMENTARY, PREFERABLY
-u, --user=name Run mysqld daemon as user.
--user-variables[=name]
Enable or disable user_variables plugin. One of: ON, OFF,
FORCE (don't start if the plugin fails to load).
--userstat Enables statistics gathering for USER_STATISTICS,
CLIENT_STATISTICS, INDEX_STATISTICS and TABLE_STATISTICS
tables in the INFORMATION_SCHEMA
-v, --verbose Used with --help option for detailed help.
-V, --version[=name]
Output version information and exit.
--wait-timeout=# The number of seconds the server waits for activity on a
connection before closing it
--wsrep-OSU-method[=name]
Method for Online Schema Upgrade. One of: TOI, RSU
--wsrep-auto-increment-control
To automatically control the assignment of autoincrement
variables
(Defaults to on; use --skip-wsrep-auto-increment-control to disable.)
--wsrep-causal-reads
Setting this variable is equivalent to setting
wsrep_sync_wait READ flag
--wsrep-certify-nonPK
Certify tables with no primary key
(Defaults to on; use --skip-wsrep-certify-nonPK to disable.)
--wsrep-cluster-address=name
Address to initially connect to cluster
--wsrep-cluster-name=name
Name for the cluster
--wsrep-convert-LOCK-to-trx
To convert locking sessions into transactions
--wsrep-data-home-dir=name
home directory for wsrep provider
--wsrep-dbug-option=name
DBUG options to provider library
--wsrep-debug To enable debug level logging
--wsrep-desync To desynchronize the node from the cluster
--wsrep-dirty-reads Allow reads even when the node is not in the primary
component.
--wsrep-drupal--workaround
Enable a workaround to handle the cases where inserting a
DEFAULT value into an auto-increment column could fail
with duplicate key error
--wsrep-forced-binlog-format=name
binlog format to take effect over user's choice. One of:
MIXED, STATEMENT, ROW, NONE
--wsrep-gtid-domain-id=#
When wsrep_gtid_mode is set, this value is used as
gtid_domain_id for galera transactions and also copied to
the joiner nodes during state transfer. It is ignored,
otherwise.
--wsrep-gtid-mode Automatically update the (joiner) node's
wsrep_gtid_domain_id value with that of donor's (received
during state transfer) and use it in place of
gtid_domain_id for all galera transactions. When OFF
(default), wsrep_gtid_domain_id is simply ignored
(backward compatibility).
--wsrep-load-data-splitting
To commit LOAD DATA transaction after every 10K rows
inserted
(Defaults to on; use --skip-wsrep-load-data-splitting to disable.)
--wsrep-log-conflicts
To log multi-master conflicts
--wsrep-max-ws-rows=#
Max number of rows in write set
--wsrep-max-ws-size=#
Max write set size (bytes)
--wsrep-mysql-replication-bundle=#
mysql replication group commit
--wsrep-new-cluster Bootstrap a cluster. It works by overriding the current
value of wsrep_cluster_address. It is recommended not to
add this option to the config file as this will trigger
bootstrap on every server start.
--wsrep-node-address=name
Specifies the node's network address, in the format ip
address[:port]. Used in situations where autoguessing is
not reliable. As of MariaDB 10.1., supports IPv6.
--wsrep-node-incoming-address=name
Client connection address
--wsrep-node-name=name
Name of this node. This name can be used in
wsrep_sst_donor as a preferred donor. Note that multiple
nodes in a cluster can have the same name.
--wsrep-notify-cmd=name
--wsrep-on To enable wsrep replication
--wsrep-provider=name
Path to replication provider library
--wsrep-provider-options=name
Semicolon (;) separated list of wsrep options (see
wsrep_provider_options documentation).
--wsrep-recover Recover database state after crash and exit
--wsrep-reject-queries[=name]
Variable to set to reject queries. One of: NONE, ALL,
ALL_KILL
--wsrep-replicate-myisam
To enable myisam replication
--wsrep-restart-slave
Should MariaDB slave be restarted automatically, when
node joins back to cluster
--wsrep-retry-autocommit=#
Max number of times to retry a failed autocommit
statement
--wsrep-slave-FK-checks
Should slave thread do foreign key constraint checks
(Defaults to on; use --skip-wsrep-slave-FK-checks to disable.)
--wsrep-slave-UK-checks
Should slave thread do secondary index uniqueness checks
--wsrep-slave-threads=#
Number of slave appliers to launch
--wsrep-sst-auth=name
Authentication for SST connection
--wsrep-sst-donor=name
preferred donor node for the SST
--wsrep-sst-donor-rejects-queries
Reject client queries when donating state snapshot
transfer
--wsrep-sst-method=name
State snapshot transfer method
--wsrep-sst-receive-address=name
Address where node is waiting for SST contact
--wsrep-start-position=name
global transaction position to start from
--wsrep-sync-wait[=#]
Ensure "synchronous" read view before executing an
operation of the type specified by bitmask: -
READ(includes SELECT, SHOW and BEGIN/START TRANSACTION);
- UPDATE and DELETE; - INSERT and REPLACE Variables (--variable-name=value)
and boolean options {FALSE|TRUE} Value (after reading options)
---------------------------------------------------------- ---------------
allow-suspicious-udfs FALSE
aria ON
aria-block-size
aria-checkpoint-interval
aria-checkpoint-log-activity
aria-encrypt-tables FALSE
aria-force-start-after-recovery-failures
aria-group-commit none
aria-group-commit-interval
aria-log-dir-path /data/mysql/
aria-log-file-size
aria-log-purge-type immediate
aria-max-sort-file-size
aria-page-checksum TRUE
aria-pagecache-age-threshold
aria-pagecache-buffer-size
aria-pagecache-division-limit
aria-pagecache-file-hash-size
aria-recover-options BACKUP,QUICK
aria-repair-threads
aria-sort-buffer-size
aria-stats-method nulls_unequal
aria-sync-log-dir NEWFILE
auto-increment-increment
auto-increment-offset
autocommit TRUE
automatic-sp-privileges TRUE
back-log
basedir /usr/local/mariadb-10.2.-linux-x86_64/
big-tables FALSE
bind-address (No default value)
binlog-annotate-row-events TRUE
binlog-cache-size
binlog-checksum CRC32
binlog-commit-wait-count
binlog-commit-wait-usec
binlog-direct-non-transactional-updates FALSE
binlog-format MIXED
binlog-optimize-thread-scheduling TRUE
binlog-row-event-max-size
binlog-row-image FULL
binlog-stmt-cache-size
bulk-insert-buffer-size
character-set-client-handshake TRUE
character-set-filesystem binary
character-set-server latin1
character-sets-dir /usr/local/mariadb-10.2.-linux-x86_64/share/charsets/
chroot (No default value)
collation-server latin1_swedish_ci
completion-type NO_CHAIN
concurrent-insert AUTO
connect-timeout
console FALSE
datadir /data/mysql/
date-format %Y-%m-%d
datetime-format %Y-%m-%d %H:%i:%s
deadlock-search-depth-long
deadlock-search-depth-short
deadlock-timeout-long
deadlock-timeout-short
debug
debug-abort-slave-event-count
debug-disconnect-slave-event-count
debug-gdb FALSE
debug-max-binlog-dump-events
debug-no-sync FALSE
debug-no-thread-alarm FALSE
debug-sporadic-binlog-dump-fail FALSE
default-regex-flags
default-storage-engine InnoDB
default-time-zone (No default value)
default-tmp-storage-engine (No default value)
default-week-format
delay-key-write ON
delayed-insert-limit
delayed-insert-timeout
delayed-queue-size
des-key-file (No default value)
div-precision-increment
encrypt-binlog FALSE
encrypt-tmp-disk-tables FALSE
encrypt-tmp-files FALSE
enforce-storage-engine (No default value)
eq-range-index-dive-limit
event-scheduler OFF
expensive-subquery-limit
expire-logs-days
explicit-defaults-for-timestamp FALSE
external-locking FALSE
extra-max-connections
extra-port
feedback ON
feedback-http-proxy (No default value)
feedback-send-retry-wait
feedback-send-timeout
feedback-url https://mariadb.org/feedback_plugin/post
feedback-user-info
flashback FALSE
flush FALSE
flush-time
ft-boolean-syntax + -><()~*:""&|
ft-max-word-len
ft-min-word-len
ft-query-expansion-limit
ft-stopword-file (No default value)
gdb FALSE
general-log FALSE
general-log-file node105.log
getopt-prefix-matching TRUE
group-concat-max-len
gtid-domain-id
gtid-ignore-duplicates FALSE
gtid-strict-mode FALSE
help TRUE
histogram-size
histogram-type SINGLE_PREC_HB
host-cache-size
ignore-builtin-innodb FALSE
ignore-db-dirs
init-connect
init-file (No default value)
init-rpl-role MASTER
init-slave
innodb ON
innodb-adaptive-flushing TRUE
innodb-adaptive-flushing-lwm
innodb-adaptive-hash-index TRUE
innodb-adaptive-hash-index-partitions
innodb-adaptive-hash-index-parts
innodb-adaptive-max-sleep-delay
innodb-autoextend-increment
innodb-autoinc-lock-mode
innodb-background-scrub-data-check-interval
innodb-background-scrub-data-compressed FALSE
innodb-background-scrub-data-interval
innodb-background-scrub-data-uncompressed FALSE
innodb-buf-dump-status-frequency
innodb-buffer-page ON
innodb-buffer-page-lru ON
innodb-buffer-pool-chunk-size
innodb-buffer-pool-dump-at-shutdown TRUE
innodb-buffer-pool-dump-now FALSE
innodb-buffer-pool-dump-pct
innodb-buffer-pool-filename ib_buffer_pool
innodb-buffer-pool-instances
innodb-buffer-pool-load-abort FALSE
innodb-buffer-pool-load-at-startup TRUE
innodb-buffer-pool-load-now FALSE
innodb-buffer-pool-populate FALSE
innodb-buffer-pool-size
innodb-buffer-pool-stats ON
innodb-change-buffer-max-size
innodb-change-buffering all
innodb-checksum-algorithm crc32
innodb-checksums TRUE
innodb-cleaner-lsn-age-factor DEPRECATED
innodb-cmp ON
innodb-cmp-per-index ON
innodb-cmp-per-index-enabled FALSE
innodb-cmp-per-index-reset ON
innodb-cmp-reset ON
innodb-cmpmem ON
innodb-cmpmem-reset ON
innodb-commit-concurrency
innodb-compression-algorithm zlib
innodb-compression-default FALSE
innodb-compression-failure-threshold-pct
innodb-compression-level
innodb-compression-pad-pct-max
innodb-concurrency-tickets
innodb-corrupt-table-action deprecated
innodb-data-file-path (No default value)
innodb-data-home-dir (No default value)
innodb-deadlock-detect TRUE
innodb-default-encryption-key-id
innodb-default-row-format dynamic
innodb-defragment FALSE
innodb-defragment-fill-factor 0.9
innodb-defragment-fill-factor-n-recs
innodb-defragment-frequency
innodb-defragment-n-pages
innodb-defragment-stats-accuracy
innodb-disable-sort-file-cache FALSE
innodb-doublewrite TRUE
innodb-empty-free-list-algorithm DEPRECATED
innodb-encrypt-log FALSE
innodb-encrypt-tables OFF
innodb-encryption-rotate-key-age
innodb-encryption-rotation-iops
innodb-encryption-threads
innodb-fake-changes FALSE
innodb-fast-shutdown
innodb-fatal-semaphore-wait-threshold
innodb-file-format Barracuda
innodb-file-format-check TRUE
innodb-file-format-max Antelope
innodb-file-io-threads
innodb-file-per-table TRUE
innodb-fill-factor
innodb-flush-log-at-timeout
innodb-flush-log-at-trx-commit
innodb-flush-method (No default value)
innodb-flush-neighbors
innodb-flush-sync TRUE
innodb-flushing-avg-loops
innodb-force-load-corrupted FALSE
innodb-force-primary-key FALSE
innodb-force-recovery
innodb-foreground-preflush DEPRECATED
innodb-ft-aux-table (No default value)
innodb-ft-being-deleted ON
innodb-ft-cache-size
innodb-ft-config ON
innodb-ft-default-stopword ON
innodb-ft-deleted ON
innodb-ft-enable-diag-print FALSE
innodb-ft-enable-stopword TRUE
innodb-ft-index-cache ON
innodb-ft-index-table ON
innodb-ft-max-token-size
innodb-ft-min-token-size
innodb-ft-num-word-optimize
innodb-ft-result-cache-limit
innodb-ft-server-stopword-table (No default value)
innodb-ft-sort-pll-degree
innodb-ft-total-cache-size
innodb-ft-user-stopword-table (No default value)
innodb-idle-flush-pct
innodb-immediate-scrub-data-uncompressed FALSE
innodb-instrument-semaphores FALSE
innodb-io-capacity
innodb-io-capacity-max
innodb-kill-idle-transaction
innodb-large-prefix TRUE
innodb-lock-schedule-algorithm fcfs
innodb-lock-wait-timeout
innodb-lock-waits ON
innodb-locking-fake-changes FALSE
innodb-locks ON
innodb-locks-unsafe-for-binlog FALSE
innodb-log-arch-dir (No default value)
innodb-log-arch-expire-sec
innodb-log-archive FALSE
innodb-log-block-size
innodb-log-buffer-size
innodb-log-checksum-algorithm DEPRECATED
innodb-log-checksums TRUE
innodb-log-compressed-pages TRUE
innodb-log-file-size
innodb-log-files-in-group
innodb-log-group-home-dir (No default value)
innodb-log-optimize-ddl TRUE
innodb-log-write-ahead-size
innodb-lru-scan-depth
innodb-max-bitmap-file-size
innodb-max-changed-pages
innodb-max-dirty-pages-pct
innodb-max-dirty-pages-pct-lwm
innodb-max-purge-lag
innodb-max-purge-lag-delay
innodb-max-undo-log-size
innodb-metrics ON
innodb-mirrored-log-groups
innodb-monitor-disable (No default value)
innodb-monitor-enable (No default value)
innodb-monitor-reset (No default value)
innodb-monitor-reset-all (No default value)
innodb-mtflush-threads
innodb-mutexes ON
innodb-old-blocks-pct
innodb-old-blocks-time
innodb-online-alter-log-max-size
innodb-open-files
innodb-optimize-fulltext-only FALSE
innodb-page-cleaners
innodb-page-size
innodb-prefix-index-cluster-optimization FALSE
innodb-print-all-deadlocks FALSE
innodb-purge-batch-size
innodb-purge-rseg-truncate-frequency
innodb-purge-threads
innodb-random-read-ahead FALSE
innodb-read-ahead-threshold
innodb-read-io-threads
innodb-read-only FALSE
innodb-replication-delay
innodb-rollback-on-timeout FALSE
innodb-rollback-segments
innodb-safe-truncate TRUE
innodb-sched-priority-cleaner
innodb-scrub-log FALSE
innodb-scrub-log-speed
innodb-show-locks-held
innodb-show-verbose-locks
innodb-sort-buffer-size
innodb-spin-wait-delay
innodb-stats-auto-recalc TRUE
innodb-stats-include-delete-marked FALSE
innodb-stats-method nulls_equal
innodb-stats-modified-counter
innodb-stats-on-metadata FALSE
innodb-stats-persistent TRUE
innodb-stats-persistent-sample-pages
innodb-stats-sample-pages
innodb-stats-traditional TRUE
innodb-stats-transient-sample-pages
innodb-status-file FALSE
innodb-status-output FALSE
innodb-status-output-locks FALSE
innodb-strict-mode TRUE
innodb-support-xa TRUE
innodb-sync-array-size
innodb-sync-spin-loops
innodb-sys-columns ON
innodb-sys-datafiles ON
innodb-sys-fields ON
innodb-sys-foreign ON
innodb-sys-foreign-cols ON
innodb-sys-indexes ON
innodb-sys-semaphore-waits ON
innodb-sys-tables ON
innodb-sys-tablespaces ON
innodb-sys-tablestats ON
innodb-sys-virtual ON
innodb-table-locks TRUE
innodb-tablespaces-encryption ON
innodb-tablespaces-scrubbing ON
innodb-temp-data-file-path (No default value)
innodb-thread-concurrency
innodb-thread-sleep-delay
innodb-tmpdir (No default value)
innodb-track-changed-pages FALSE
innodb-track-redo-log-now FALSE
innodb-trx ON
innodb-undo-directory (No default value)
innodb-undo-log-truncate FALSE
innodb-undo-logs
innodb-undo-tablespaces
innodb-use-atomic-writes TRUE
innodb-use-fallocate FALSE
innodb-use-global-flush-log-at-trx-commit FALSE
innodb-use-mtflush FALSE
innodb-use-native-aio TRUE
innodb-use-stacktrace FALSE
innodb-use-trim TRUE
innodb-write-io-threads
interactive-timeout
join-buffer-size
join-buffer-space-limit
join-cache-level
keep-files-on-create FALSE
key-buffer-size
key-cache-age-threshold
key-cache-block-size
key-cache-division-limit
key-cache-file-hash-size
key-cache-segments
large-files-support TRUE
large-pages FALSE
lc-messages en_US
lc-messages-dir (No default value)
lc-time-names en_US
local-infile TRUE
lock-wait-timeout
log-basename node105.yinzhengjie.org.cn
log-bin mysql-bin
log-bin-compress FALSE
log-bin-compress-min-len
log-bin-index (No default value)
log-bin-trust-function-creators FALSE
log-error
log-isam myisam.log
log-output FILE
log-queries-not-using-indexes FALSE
log-short-format FALSE
log-slave-updates FALSE
log-slow-admin-statements TRUE
log-slow-filter admin,filesort,filesort_on_disk,full_join,full_scan,query_cache,query_cache_miss,tmp_t
able,tmp_table_on_disk
log-slow-rate-limit
log-slow-slave-statements TRUE
log-slow-verbosity
log-tc tc.log
log-tc-size
log-warnings
long-query-time
low-priority-updates FALSE
lower-case-file-system FALSE
lower-case-table-names
master-info-file master.info
master-retry-count
master-verify-checksum FALSE
max-allowed-packet
max-binlog-cache-size
max-binlog-size
max-binlog-stmt-cache-size
max-connect-errors
max-connections
max-delayed-threads
max-digest-length
max-error-count
max-heap-table-size
max-join-size
max-length-for-sort-data
max-long-data-size
max-prepared-stmt-count
max-recursive-iterations
max-relay-log-size
max-seeks-for-key
max-session-mem-used
max-sort-length
max-sp-recursion-depth
max-statement-time
max-tmp-tables
max-user-connections
max-write-lock-count
memlock FALSE
metadata-locks-cache-size
metadata-locks-hash-instances
min-examined-row-limit
mrr-buffer-size
multi-range-count
myisam-block-size
myisam-data-pointer-size
myisam-max-sort-file-size
myisam-mmap-size
myisam-recover-options BACKUP,QUICK
myisam-repair-threads
myisam-sort-buffer-size
myisam-stats-method NULLS_UNEQUAL
myisam-use-mmap FALSE
mysql56-temporal-format TRUE
net-buffer-length
net-read-timeout
net-retry-count
net-write-timeout
old FALSE
old-alter-table FALSE
old-mode
old-passwords FALSE
old-style-user-limits FALSE
open-files-limit
optimizer-prune-level
optimizer-search-depth
optimizer-selectivity-sampling-limit
optimizer-switch index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection
=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=
on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off
,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_b
ka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_deriv
ed=on
optimizer-use-condition-selectivity
partition ON
performance-schema FALSE
performance-schema-accounts-size -
performance-schema-consumer-events-stages-current FALSE
performance-schema-consumer-events-stages-history FALSE
performance-schema-consumer-events-stages-history-long FALSE
performance-schema-consumer-events-statements-current TRUE
performance-schema-consumer-events-statements-history FALSE
performance-schema-consumer-events-statements-history-long FALSE
performance-schema-consumer-events-waits-current FALSE
performance-schema-consumer-events-waits-history FALSE
performance-schema-consumer-events-waits-history-long FALSE
performance-schema-consumer-global-instrumentation TRUE
performance-schema-consumer-statements-digest TRUE
performance-schema-consumer-thread-instrumentation TRUE
performance-schema-digests-size -
performance-schema-events-stages-history-long-size -
performance-schema-events-stages-history-size -
performance-schema-events-statements-history-long-size -
performance-schema-events-statements-history-size -
performance-schema-events-waits-history-long-size -
performance-schema-events-waits-history-size -
performance-schema-hosts-size -
performance-schema-instrument
performance-schema-max-cond-classes
performance-schema-max-cond-instances -
performance-schema-max-digest-length
performance-schema-max-file-classes
performance-schema-max-file-handles
performance-schema-max-file-instances -
performance-schema-max-mutex-classes
performance-schema-max-mutex-instances -
performance-schema-max-rwlock-classes
performance-schema-max-rwlock-instances -
performance-schema-max-socket-classes
performance-schema-max-socket-instances -
performance-schema-max-stage-classes
performance-schema-max-statement-classes
performance-schema-max-table-handles -
performance-schema-max-table-instances -
performance-schema-max-thread-classes
performance-schema-max-thread-instances -
performance-schema-session-connect-attrs-size -
performance-schema-setup-actors-size
performance-schema-setup-objects-size
performance-schema-users-size -
pid-file /data/mysql/node105.pid
plugin-dir /usr/local/mariadb-10.2.-linux-x86_64/lib/plugin/
plugin-maturity unknown
port
port-open-timeout
preload-buffer-size
profiling-history-size
progress-report-time
protocol-version
query-alloc-block-size
query-cache-limit
query-cache-min-res-unit
query-cache-size
query-cache-strip-comments FALSE
query-cache-type ON
query-cache-wlock-invalidate FALSE
query-prealloc-size
range-alloc-block-size
read-binlog-speed-limit
read-buffer-size
read-only FALSE
read-rnd-buffer-size
relay-log (No default value)
relay-log-index (No default value)
relay-log-info-file relay-log.info
relay-log-purge TRUE
relay-log-recovery FALSE
relay-log-space-limit
replicate-annotate-row-events TRUE
replicate-events-marked-for-skip REPLICATE
replicate-same-server-id FALSE
report-host (No default value)
report-password (No default value)
report-port
report-user (No default value)
rowid-merge-buff-size
safe-user-create FALSE
secure-auth TRUE
secure-file-priv (No default value)
sequence ON
server-id
session-track-schema TRUE
session-track-state-change FALSE
session-track-system-variables
session-track-transaction-info OFF
show-slave-auth-info FALSE
silent-startup FALSE
skip-grant-tables FALSE
skip-name-resolve FALSE
skip-networking FALSE
skip-show-database FALSE
skip-slave-start FALSE
slave-compressed-protocol FALSE
slave-ddl-exec-mode IDEMPOTENT
slave-domain-parallel-threads
slave-exec-mode STRICT
slave-load-tmpdir /tmp
slave-max-allowed-packet
slave-net-timeout
slave-parallel-max-queued
slave-parallel-mode conservative
slave-parallel-threads
slave-parallel-workers
slave-run-triggers-for-rbr NO
slave-skip-errors (No default value)
slave-sql-verify-checksum TRUE
slave-transaction-retries
slave-type-conversions
slow-launch-time
slow-query-log FALSE
slow-query-log-file node105-slow.log
socket /tmp/mysql.sock
sort-buffer-size
sql-mode STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUT
ION
ssl FALSE
ssl-ca (No default value)
ssl-capath (No default value)
ssl-cert (No default value)
ssl-cipher (No default value)
ssl-crl (No default value)
ssl-crlpath (No default value)
ssl-key (No default value)
stack-trace TRUE
standard-compliant-cte TRUE
stored-program-cache
strict-password-validation TRUE
super-large-pages FALSE
symbolic-links FALSE
sync-binlog
sync-frm TRUE
sync-master-info
sync-relay-log
sync-relay-log-info
sysdate-is-now FALSE
system-time-zone CST
table-cache
table-definition-cache
table-open-cache
table-open-cache-instances
tc-heuristic-recover OFF
temp-pool TRUE
thread-cache-size
thread-concurrency
thread-handling one-thread-per-connection
thread-pool-idle-timeout
thread-pool-max-threads
thread-pool-oversubscribe
thread-pool-prio-kickup-timer
thread-pool-priority auto
thread-pool-size
thread-pool-stall-limit
thread-stack
time-format %H:%i:%s
timed-mutexes FALSE
tmp-disk-table-size
tmp-memory-table-size
tmp-table-size
tmpdir /tmp
transaction-alloc-block-size
transaction-isolation REPEATABLE-READ
transaction-prealloc-size
transaction-read-only FALSE
updatable-views-with-limit YES
use-stat-tables NEVER
user-variables ON
userstat FALSE
verbose TRUE
version 10.2.-MariaDB-log
version-comment MariaDB Server
version-compile-machine x86_64
version-compile-os Linux
version-malloc-library system
version-ssl-library YaSSL 2.4.
wait-timeout
wsrep-OSU-method TOI
wsrep-auto-increment-control TRUE
wsrep-causal-reads FALSE
wsrep-certify-nonPK TRUE
wsrep-cluster-address
wsrep-cluster-name my_wsrep_cluster
wsrep-convert-LOCK-to-trx FALSE
wsrep-data-home-dir /data/mysql/
wsrep-dbug-option
wsrep-debug FALSE
wsrep-desync FALSE
wsrep-dirty-reads FALSE
wsrep-drupal--workaround FALSE
wsrep-forced-binlog-format NONE
wsrep-gtid-domain-id
wsrep-gtid-mode FALSE
wsrep-load-data-splitting TRUE
wsrep-log-conflicts FALSE
wsrep-max-ws-rows
wsrep-max-ws-size
wsrep-mysql-replication-bundle
wsrep-new-cluster FALSE
wsrep-node-address
wsrep-node-incoming-address AUTO
wsrep-node-name node105.yinzhengjie.org.cn
wsrep-notify-cmd
wsrep-on FALSE
wsrep-patch-version wsrep_25.
wsrep-provider none
wsrep-provider-options
wsrep-recover FALSE
wsrep-reject-queries NONE
wsrep-replicate-myisam FALSE
wsrep-restart-slave FALSE
wsrep-retry-autocommit
wsrep-log-conflicts FALSE
wsrep-max-ws-rows
wsrep-max-ws-size
wsrep-mysql-replication-bundle
wsrep-new-cluster FALSE
wsrep-node-address
wsrep-node-incoming-address AUTO
wsrep-node-name node105.yinzhengjie.org.cn
wsrep-notify-cmd
wsrep-on FALSE
wsrep-patch-version wsrep_25.
wsrep-provider none
wsrep-provider-options
wsrep-recover FALSE
wsrep-reject-queries NONE
wsrep-replicate-myisam FALSE
wsrep-restart-slave FALSE
wsrep-retry-autocommit
wsrep-slave-FK-checks TRUE
wsrep-slave-UK-checks FALSE
wsrep-slave-threads
wsrep-sst-auth (No default value)
wsrep-sst-donor
wsrep-sst-donor-rejects-queries FALSE
wsrep-sst-method rsync
wsrep-sst-receive-address AUTO
wsrep-start-position ----:-
wsrep-sync-wait To see what values a running MySQL server is using, type
'mysqladmin variables' instead of 'mysqld --verbose --help'.
[root@node105.yinzhengjie.org.cn ~]#

[root@node105.yinzhengjie.org.cn ~]# mysqld --help --verbose | more      #查看MySQL支持的所有服务器选项

[root@node105.yinzhengjie.org.cn ~]# mysqld --print-defaults                       #获取默认设置
mysqld would have been started with the following arguments:
--datadir=/var/lib/mysql --socket=/var/lib/mysql/mysql.sock --symbolic-links= --datadir=/data/mysql --port= --socket=/tmp/mysql.sock --skip-
external-locking --key_buffer_size=384M --max_allowed_packet=1M --table_open_cache= --sort_buffer_size=2M --read_buffer_size=2M --read_rnd_buffer_size=8M --myisam_sort_buffer_size=64M --thread_cache_size= --query_cache_size=32M --thread_concurrency= --log-bin=mysql-bin --server-id=
[root@node105.yinzhengjie.org.cn ~]#

3>.设置服务器选项方法

[root@node105.yinzhengjie.org.cn ~]# /usr/local/mysql/bin/mysqld_safe --skip-name-resolve= --defaults-file=/mysql//etc/my.cnf  &> /dev/null  &     
[]
[root@node105.yinzhengjie.org.cn ~]#

在命令行中设置

[root@node105.yinzhengjie.org.cn ~]# cat /mysql//etc/my.cnf
[mysqld]
character-set-server = utf8mb4
default_storage_engine = InnoDB
skip_name_resolve =
port =
datadir = /mysql//data
socket = /mysql//socket/mysql.sock [mysqld_safe]
log-error = /mysql//log/mariadb.log
pid-file = /mysql//pid/mariadb.pid [root@node105.yinzhengjie.org.cn ~]#
[root@node105.yinzhengjie.org.cn ~]#

在配置文件my.cnf中设置

4>.获取系统变量(分全局和会话两种)

MariaDB [yinzhengjie]> SHOW GLOBAL VARIABLES\G
......
*************************** . row ***************************
Variable_name: wsrep_node_incoming_address
Value: AUTO
*************************** . row ***************************
Variable_name: wsrep_node_name
Value: node105.yinzhengjie.org.cn
*************************** . row ***************************
Variable_name: wsrep_notify_cmd
Value:
*************************** . row ***************************
Variable_name: wsrep_on
Value: OFF
*************************** . row ***************************
Variable_name: wsrep_patch_version
Value: wsrep_25.
*************************** . row ***************************
Variable_name: wsrep_provider
Value: none
*************************** . row ***************************
Variable_name: wsrep_provider_options
Value:
*************************** . row ***************************
Variable_name: wsrep_recover
Value: OFF
*************************** . row ***************************
Variable_name: wsrep_reject_queries
Value: NONE
*************************** . row ***************************
Variable_name: wsrep_replicate_myisam
Value: OFF
*************************** . row ***************************
Variable_name: wsrep_restart_slave
Value: OFF
*************************** . row ***************************
Variable_name: wsrep_retry_autocommit
Value:
*************************** . row ***************************
Variable_name: wsrep_slave_fk_checks
Value: ON
*************************** . row ***************************
Variable_name: wsrep_slave_uk_checks
Value: OFF
*************************** . row ***************************
Variable_name: wsrep_slave_threads
Value:
*************************** . row ***************************
Variable_name: wsrep_sst_auth
Value:
*************************** . row ***************************
Variable_name: wsrep_sst_donor
Value:
*************************** . row ***************************
Variable_name: wsrep_sst_donor_rejects_queries
Value: OFF
*************************** . row ***************************
Variable_name: wsrep_sst_method
Value: rsync
*************************** . row ***************************
Variable_name: wsrep_sst_receive_address
Value: AUTO
*************************** . row ***************************
Variable_name: wsrep_start_position
Value: ----:-
*************************** . row ***************************
Variable_name: wsrep_sync_wait
Value:
rows in set (0.00 sec) MariaDB [yinzhengjie]>

MariaDB [yinzhengjie]> SHOW GLOBAL VARIABLES\G      #查看全局变量

MariaDB [yinzhengjie]> SHOW SESSION VARIABLES\G
......
*************************** . row ***************************
Variable_name: wsrep_cluster_address
Value:
*************************** . row ***************************
Variable_name: wsrep_cluster_name
Value: my_wsrep_cluster
*************************** . row ***************************
Variable_name: wsrep_convert_lock_to_trx
Value: OFF
*************************** . row ***************************
Variable_name: wsrep_data_home_dir
Value: /mysql//data/
*************************** . row ***************************
Variable_name: wsrep_dbug_option
Value:
*************************** . row ***************************
Variable_name: wsrep_debug
Value: OFF
*************************** . row ***************************
Variable_name: wsrep_desync
Value: OFF
*************************** . row ***************************
Variable_name: wsrep_dirty_reads
Value: OFF
*************************** . row ***************************
Variable_name: wsrep_drupal_282555_workaround
Value: OFF
*************************** . row ***************************
Variable_name: wsrep_forced_binlog_format
Value: NONE
*************************** . row ***************************
Variable_name: wsrep_gtid_domain_id
Value:
*************************** . row ***************************
Variable_name: wsrep_gtid_mode
Value: OFF
*************************** . row ***************************
Variable_name: wsrep_load_data_splitting
Value: ON
*************************** . row ***************************
Variable_name: wsrep_log_conflicts
Value: OFF
*************************** . row ***************************
Variable_name: wsrep_max_ws_rows
Value:
*************************** . row ***************************
Variable_name: wsrep_max_ws_size
Value:
*************************** . row ***************************
Variable_name: wsrep_mysql_replication_bundle
Value:
*************************** . row ***************************
Variable_name: wsrep_node_address
Value:
*************************** . row ***************************
Variable_name: wsrep_node_incoming_address
Value: AUTO
*************************** . row ***************************
Variable_name: wsrep_node_name
Value: node105.yinzhengjie.org.cn
*************************** . row ***************************
Variable_name: wsrep_notify_cmd
Value:
*************************** . row ***************************
Variable_name: wsrep_on
Value: OFF
*************************** . row ***************************
Variable_name: wsrep_patch_version
Value: wsrep_25.
*************************** . row ***************************
Variable_name: wsrep_provider
Value: none
*************************** . row ***************************
Variable_name: wsrep_provider_options
Value:
*************************** . row ***************************
Variable_name: wsrep_recover
Value: OFF
*************************** . row ***************************
Variable_name: wsrep_reject_queries
Value: NONE
*************************** . row ***************************
Variable_name: wsrep_replicate_myisam
Value: OFF
*************************** . row ***************************
Variable_name: wsrep_restart_slave
Value: OFF
*************************** . row ***************************
Variable_name: wsrep_retry_autocommit
Value:
*************************** . row ***************************
Variable_name: wsrep_slave_fk_checks
Value: ON
*************************** . row ***************************
Variable_name: wsrep_slave_uk_checks
Value: OFF
*************************** . row ***************************
Variable_name: wsrep_slave_threads
Value:
*************************** . row ***************************
Variable_name: wsrep_sst_auth
Value:
*************************** . row ***************************
Variable_name: wsrep_sst_donor
Value:
*************************** . row ***************************
Variable_name: wsrep_sst_donor_rejects_queries
Value: OFF
*************************** . row ***************************
Variable_name: wsrep_sst_method
Value: rsync
*************************** . row ***************************
Variable_name: wsrep_sst_receive_address
Value: AUTO
*************************** . row ***************************
Variable_name: wsrep_start_position
Value: ----:-
*************************** . row ***************************
Variable_name: wsrep_sync_wait
Value:
rows in set (0.00 sec) MariaDB [yinzhengjie]>
MariaDB [yinzhengjie]>

MariaDB [yinzhengjie]> SHOW SESSION VARIABLES\G      #查看会话变量

MariaDB [yinzhengjie]> SHOW VARIABLES LIKE '%character%';
+--------------------------+---------------------------------------------------------+
| Variable_name | Value |
+--------------------------+---------------------------------------------------------+
| character_set_client | utf8mb4 |
| character_set_connection | utf8mb4 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8mb4 |
| character_set_server | utf8mb4 |
| character_set_system | utf8 |
| character_sets_dir | /usr/local/mariadb-10.2.-linux-x86_64/share/charsets/ |
+--------------------------+---------------------------------------------------------+
rows in set (0.00 sec) MariaDB [yinzhengjie]>

MariaDB [yinzhengjie]> SHOW VARIABLES LIKE '%character%';    #需要注意服务器选项和系统变量的区别,服务器选项和系统变量均可用在MySQL数据库中查看,但系统变量无法写入文件,它仅能在内存中保存,一旦重启MySQL实例变量就会被清空。服务器选项是可用永久写入配置文件中的。

MariaDB [yinzhengjie]> SELECT @@character_set_server;    #查看具体的会话系统变量名称
+------------------------+
| @@character_set_server |
+------------------------+
| utf8mb4 |
+------------------------+
row in set (0.00 sec) MariaDB [yinzhengjie]>

MariaDB [yinzhengjie]> SELECT @@character_set_server;    #查看具体的会话系统变量名称

5>.修改服务器变量的值

MariaDB [yinzhengjie]> HELP SET
Name: 'SET'
Description:
Syntax:
SET variable_assignment [, variable_assignment] ... variable_assignment:
user_var_name = expr
| [GLOBAL | SESSION] system_var_name = expr
| [@@global. | @@session. | @@]system_var_name = expr The SET statement assigns values to different types of variables that
affect the operation of the server or your client. Older versions of
MySQL employed SET OPTION, but this syntax is deprecated in favor of
SET without OPTION. URL: https://mariadb.com/kb/en/set/ MariaDB [yinzhengjie]>
MariaDB [yinzhengjie]>

MariaDB [yinzhengjie]> HELP SET

MariaDB [yinzhengjie]> SELECT @@character_set_database;
+--------------------------+
| @@character_set_database |
+--------------------------+
| utf8 |
+--------------------------+
row in set (0.00 sec) MariaDB [yinzhengjie]>
MariaDB [yinzhengjie]> SET character_set_database = utf8mb4;      #修改会话变量
Query OK, rows affected (0.00 sec) MariaDB [yinzhengjie]>
MariaDB [yinzhengjie]> SELECT @@character_set_database;
+--------------------------+
| @@character_set_database |
+--------------------------+
| utf8mb4 |
+--------------------------+
row in set (0.00 sec) MariaDB [yinzhengjie]>

MariaDB [yinzhengjie]> SET character_set_database = utf8mb4;      #修改会话变量

MariaDB [yinzhengjie]> SELECT @@character_set_database;
+--------------------------+
| @@character_set_database |
+--------------------------+
| utf8mb4 |
+--------------------------+
1 row in set (0.00 sec) MariaDB [yinzhengjie]>
MariaDB [yinzhengjie]> SET SESSION character_set_database = utf8;      #修改会话变量(同上,此处SESSION可用省略不写)
Query OK, 0 rows affected (0.00 sec) MariaDB [yinzhengjie]>
MariaDB [yinzhengjie]> SELECT @@character_set_database;
+--------------------------+
| @@character_set_database |
+--------------------------+
| utf8 |
+--------------------------+
1 row in set (0.00 sec) MariaDB [yinzhengjie]>
MariaDB [yinzhengjie]>

MariaDB [yinzhengjie]> SET SESSION character_set_database = utf8;    #修改会话变量(同上,此处SESSION可用省略不写)

MariaDB [yinzhengjie]> SELECT @@character_set_database;
+--------------------------+
| @@character_set_database |
+--------------------------+
| utf8 |
+--------------------------+
1 row in set (0.00 sec) MariaDB [yinzhengjie]>
MariaDB [yinzhengjie]> SET @@character_set_database = utf8mb4;      #修改会话变量
Query OK, 0 rows affected (0.00 sec) MariaDB [yinzhengjie]>
MariaDB [yinzhengjie]> SELECT @@character_set_database;
+--------------------------+
| @@character_set_database |
+--------------------------+
| utf8mb4 |
+--------------------------+
1 row in set (0.00 sec) MariaDB [yinzhengjie]>
MariaDB [yinzhengjie]>

MariaDB [yinzhengjie]> SET @@character_set_database = utf8mb4;      #修改会话变量

MariaDB [yinzhengjie]> SELECT @@character_set_database;
+--------------------------+
| @@character_set_database |
+--------------------------+
| utf8mb4 |
+--------------------------+
1 row in set (0.00 sec) MariaDB [yinzhengjie]>
MariaDB [yinzhengjie]> SET @@SESSION.character_set_database = utf8;    #同上,此处"SESSION."可用省略不写
Query OK, 0 rows affected (0.00 sec) MariaDB [yinzhengjie]>
MariaDB [yinzhengjie]> SELECT @@character_set_database;
+--------------------------+
| @@character_set_database |
+--------------------------+
| utf8 |
+--------------------------+
1 row in set (0.00 sec) MariaDB [yinzhengjie]>
MariaDB [yinzhengjie]>

MariaDB [yinzhengjie]> SET @@SESSION.character_set_database = utf8;   #同上,此处"SESSION."可用省略不写

MariaDB [yinzhengjie]> SHOW GLOBAL VARIABLES LIKE '%character%';
+--------------------------+---------------------------------------------------------+
| Variable_name | Value |
+--------------------------+---------------------------------------------------------+
| character_set_client | utf8mb4 |
| character_set_connection | utf8mb4 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8mb4 |
| character_set_server | utf8mb4 |
| character_set_system | utf8 |
| character_sets_dir | /usr/local/mariadb-10.2.19-linux-x86_64/share/charsets/ |
+--------------------------+---------------------------------------------------------+
8 rows in set (0.00 sec) MariaDB [yinzhengjie]>
MariaDB [yinzhengjie]> SET GLOBAL character_set_server = gbk;      #修改全局变量,仅对修改后新创建的会话有效;对已经建立的会话无效。
Query OK, 0 rows affected (0.00 sec) MariaDB [yinzhengjie]>
MariaDB [yinzhengjie]> SHOW GLOBAL VARIABLES LIKE '%character%';
+--------------------------+---------------------------------------------------------+
| Variable_name | Value |
+--------------------------+---------------------------------------------------------+
| character_set_client | utf8mb4 |
| character_set_connection | utf8mb4 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8mb4 |
| character_set_server | gbk |
| character_set_system | utf8 |
| character_sets_dir | /usr/local/mariadb-10.2.19-linux-x86_64/share/charsets/ |
+--------------------------+---------------------------------------------------------+
8 rows in set (0.00 sec) MariaDB [yinzhengjie]>
MariaDB [yinzhengjie]>

MariaDB [yinzhengjie]> SET GLOBAL character_set_server = gbk;      #修改全局变量,仅对修改后新创建的会话有效;对已经建立的会话无效。

MariaDB [yinzhengjie]> SHOW GLOBAL VARIABLES LIKE '%character%';
+--------------------------+---------------------------------------------------------+
| Variable_name | Value |
+--------------------------+---------------------------------------------------------+
| character_set_client | utf8mb4 |
| character_set_connection | utf8mb4 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8mb4 |
| character_set_server | gbk |
| character_set_system | utf8 |
| character_sets_dir | /usr/local/mariadb-10.2.19-linux-x86_64/share/charsets/ |
+--------------------------+---------------------------------------------------------+
8 rows in set (0.00 sec) MariaDB [yinzhengjie]>
MariaDB [yinzhengjie]> SET @@GLOBAL.character_set_server = utf8mb4;      #修改全局变量,此处的"GLOBAL."可以省略不写
Query OK, 0 rows affected (0.01 sec) MariaDB [yinzhengjie]>
MariaDB [yinzhengjie]> SHOW GLOBAL VARIABLES LIKE '%character%';
+--------------------------+---------------------------------------------------------+
| Variable_name | Value |
+--------------------------+---------------------------------------------------------+
| character_set_client | utf8mb4 |
| character_set_connection | utf8mb4 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8mb4 |
| character_set_server | utf8mb4 |
| character_set_system | utf8 |
| character_sets_dir | /usr/local/mariadb-10.2.19-linux-x86_64/share/charsets/ |
+--------------------------+---------------------------------------------------------+
8 rows in set (0.00 sec) MariaDB [yinzhengjie]>

MariaDB [yinzhengjie]> SET @@GLOBAL.character_set_server = utf8mb4;    #修改全局变量,此处的"GLOBAL."可以省略不写

6>.查看服务器状态变量(分全局和会话两种,用于保存mysqld运行中的统计数据的变量,不可更改。)

MariaDB [yinzhengjie]> SHOW GLOBAL STATUS;                                   #查看全局状态变量
+--------------------------------------------------------------+--------------------------------------------------+
| Variable_name | Value |
+--------------------------------------------------------------+--------------------------------------------------+
| Aborted_clients | 0 |
| Aborted_connects | 4 |
| Access_denied_errors | 5 |
| Acl_column_grants | 2 |
| Acl_database_grants | 1 |
| Acl_function_grants | 0 |
| Acl_procedure_grants | 0 |
| Acl_proxy_users | 2 |
| Acl_role_grants | 0 |
| Acl_roles | 0 |
| Acl_table_grants | 1 |
| Acl_users | 5 |
| Aria_pagecache_blocks_not_flushed | 0 |
| Aria_pagecache_blocks_unused | 15706 |
| Aria_pagecache_blocks_used | 2 |
| Aria_pagecache_read_requests | 12 |
| Aria_pagecache_reads | 2 |
| Aria_pagecache_write_requests | 4 |
| Aria_pagecache_writes | 0 |
| Aria_transaction_log_syncs | 0 |
| Binlog_commits | 0 |
| Binlog_group_commits | 0 |
| Binlog_group_commit_trigger_count | 0 |
| Binlog_group_commit_trigger_lock_wait | 0 |
| Binlog_group_commit_trigger_timeout | 0 |
| Binlog_snapshot_file | |
| Binlog_snapshot_position | 0 |
| Binlog_bytes_written | 0 |
| Binlog_cache_disk_use | 0 |
| Binlog_cache_use | 0 |
| Binlog_stmt_cache_disk_use | 0 |
| Binlog_stmt_cache_use | 0 |
| Busy_time | 0.000000 |
| Bytes_received | 7623 |
| Bytes_sent | 402252 |
| Com_admin_commands | 0 |
| Com_alter_db | 0 |
| Com_alter_db_upgrade | 0 |
| Com_alter_event | 0 |
| Com_alter_function | 0 |
| Com_alter_procedure | 0 |
| Com_alter_server | 0 |
| Com_alter_table | 0 |
| Com_alter_tablespace | 0 |
| Com_alter_user | 0 |
| Com_analyze | 0 |
| Com_assign_to_keycache | 0 |
| Com_begin | 0 |
| Com_binlog | 0 |
| Com_call_procedure | 0 |
| Com_change_db | 8 |
| Com_change_master | 0 |
| Com_check | 0 |
| Com_checksum | 0 |
| Com_commit | 0 |
| Com_compound_sql | 0 |
| Com_create_db | 0 |
| Com_create_event | 0 |
| Com_create_function | 0 |
| Com_create_index | 0 |
| Com_create_procedure | 0 |
| Com_create_role | 0 |
| Com_create_server | 0 |
| Com_create_table | 0 |
| Com_create_temporary_table | 0 |
| Com_create_trigger | 0 |
| Com_create_udf | 0 |
| Com_create_user | 0 |
| Com_create_view | 0 |
| Com_dealloc_sql | 0 |
| Com_delete | 0 |
| Com_delete_multi | 0 |
| Com_do | 0 |
| Com_drop_db | 0 |
| Com_drop_event | 0 |
| Com_drop_function | 0 |
| Com_drop_index | 0 |
| Com_drop_procedure | 0 |
| Com_drop_role | 0 |
| Com_drop_server | 0 |
| Com_drop_table | 1 |
| Com_drop_temporary_table | 0 |
| Com_drop_trigger | 0 |
| Com_drop_user | 0 |
| Com_drop_view | 0 |
| Com_empty_query | 0 |
| Com_execute_immediate | 0 |
| Com_execute_sql | 0 |
| Com_flush | 2 |
| Com_get_diagnostics | 0 |
| Com_grant | 2 |
| Com_grant_role | 0 |
| Com_ha_close | 0 |
| Com_ha_open | 0 |
| Com_ha_read | 0 |
| Com_help | 6 |
| Com_insert | 0 |
| Com_insert_select | 0 |
| Com_install_plugin | 0 |
| Com_kill | 0 |
| Com_load | 0 |
| Com_lock_tables | 0 |
| Com_multi | 0 |
| Com_optimize | 0 |
| Com_preload_keys | 0 |
| Com_prepare_sql | 0 |
| Com_purge | 0 |
| Com_purge_before_date | 0 |
| Com_release_savepoint | 0 |
| Com_rename_table | 0 |
| Com_rename_user | 0 |
| Com_repair | 0 |
| Com_replace | 0 |
| Com_replace_select | 0 |
| Com_reset | 0 |
| Com_resignal | 0 |
| Com_revoke | 1 |
| Com_revoke_all | 0 |
| Com_revoke_role | 0 |
| Com_rollback | 0 |
| Com_rollback_to_savepoint | 0 |
| Com_savepoint | 0 |
| Com_select | 48 |
| Com_set_option | 11 |
| Com_show_authors | 0 |
| Com_show_binlog_events | 0 |
| Com_show_binlogs | 0 |
| Com_show_charsets | 0 |
| Com_show_collations | 0 |
| Com_show_contributors | 0 |
| Com_show_create_db | 0 |
| Com_show_create_event | 0 |
| Com_show_create_func | 0 |
| Com_show_create_proc | 0 |
| Com_show_create_table | 4 |
| Com_show_create_trigger | 0 |
| Com_show_create_user | 0 |
| Com_show_databases | 9 |
| Com_show_engine_logs | 0 |
| Com_show_engine_mutex | 0 |
| Com_show_engine_status | 0 |
| Com_show_errors | 0 |
| Com_show_events | 0 |
| Com_show_explain | 0 |
| Com_show_fields | 11 |
| Com_show_function_status | 0 |
| Com_show_generic | 0 |
| Com_show_grants | 10 |
| Com_show_keys | 0 |
| Com_show_master_status | 0 |
| Com_show_open_tables | 0 |
| Com_show_plugins | 0 |
| Com_show_privileges | 0 |
| Com_show_procedure_status | 0 |
| Com_show_processlist | 0 |
| Com_show_profile | 0 |
| Com_show_profiles | 0 |
| Com_show_relaylog_events | 0 |
| Com_show_slave_hosts | 0 |
| Com_show_slave_status | 0 |
| Com_show_status | 4 |
| Com_show_storage_engines | 2 |
| Com_show_table_status | 9 |
| Com_show_tables | 10 |
| Com_show_triggers | 0 |
| Com_show_variables | 28 |
| Com_show_warnings | 0 |
| Com_shutdown | 0 |
| Com_signal | 0 |
| Com_start_all_slaves | 0 |
| Com_start_slave | 0 |
| Com_stmt_close | 0 |
| Com_stmt_execute | 0 |
| Com_stmt_fetch | 0 |
| Com_stmt_prepare | 0 |
| Com_stmt_reprepare | 0 |
| Com_stmt_reset | 0 |
| Com_stmt_send_long_data | 0 |
| Com_stop_all_slaves | 0 |
| Com_stop_slave | 0 |
| Com_truncate | 0 |
| Com_uninstall_plugin | 0 |
| Com_unlock_tables | 0 |
| Com_update | 3 |
| Com_update_multi | 0 |
| Com_xa_commit | 0 |
| Com_xa_end | 0 |
| Com_xa_prepare | 0 |
| Com_xa_recover | 0 |
| Com_xa_rollback | 0 |
| Com_xa_start | 0 |
| Compression | OFF |
| Connection_errors_accept | 0 |
| Connection_errors_internal | 0 |
| Connection_errors_max_connections | 0 |
| Connection_errors_peer_address | 0 |
| Connection_errors_select | 0 |
| Connection_errors_tcpwrap | 0 |
| Connections | 17 |
| Cpu_time | 0.000000 |
| Created_tmp_disk_tables | 2 |
| Created_tmp_files | 5 |
| Created_tmp_tables | 62 |
| Delayed_errors | 0 |
| Delayed_insert_threads | 0 |
| Delayed_writes | 0 |
| Delete_scan | 0 |
| Empty_queries | 1 |
| Executed_events | 0 |
| Executed_triggers | 0 |
| Feature_check_constraint | 0 |
| Feature_delay_key_write | 0 |
| Feature_dynamic_columns | 0 |
| Feature_fulltext | 0 |
| Feature_gis | 0 |
| Feature_locale | 0 |
| Feature_subquery | 0 |
| Feature_timezone | 0 |
| Feature_trigger | 0 |
| Feature_window_functions | 0 |
| Feature_xml | 0 |
| Flush_commands | 1 |
| Handler_commit | 5 |
| Handler_delete | 0 |
| Handler_discover | 0 |
| Handler_external_lock | 0 |
| Handler_icp_attempts | 0 |
| Handler_icp_match | 0 |
| Handler_mrr_init | 0 |
| Handler_mrr_key_refills | 0 |
| Handler_mrr_rowid_refills | 0 |
| Handler_prepare | 0 |
| Handler_read_first | 7 |
| Handler_read_key | 21 |
| Handler_read_last | 0 |
| Handler_read_next | 5 |
| Handler_read_prev | 0 |
| Handler_read_retry | 0 |
| Handler_read_rnd | 0 |
| Handler_read_rnd_deleted | 4 |
| Handler_read_rnd_next | 10995 |
| Handler_rollback | 2 |
| Handler_savepoint | 0 |
| Handler_savepoint_rollback | 0 |
| Handler_tmp_update | 0 |
| Handler_tmp_write | 10728 |
| Handler_update | 3 |
| Handler_write | 5 |
| Innodb_buffer_pool_dump_status | |
| Innodb_buffer_pool_load_status | Buffer pool(s) load completed at 191029 7:20:21 |
| Innodb_buffer_pool_resize_status | |
| Innodb_buffer_pool_pages_data | 499 |
| Innodb_buffer_pool_bytes_data | 8175616 |
| Innodb_buffer_pool_pages_dirty | 0 |
| Innodb_buffer_pool_bytes_dirty | 0 |
| Innodb_buffer_pool_pages_flushed | 152 |
| Innodb_buffer_pool_pages_free | 7692 |
| Innodb_buffer_pool_pages_misc | 0 |
| Innodb_buffer_pool_pages_total | 8191 |
| Innodb_buffer_pool_read_ahead_rnd | 0 |
| Innodb_buffer_pool_read_ahead | 0 |
| Innodb_buffer_pool_read_ahead_evicted | 0 |
| Innodb_buffer_pool_read_requests | 2674 |
| Innodb_buffer_pool_reads | 369 |
| Innodb_buffer_pool_wait_free | 0 |
| Innodb_buffer_pool_write_requests | 1168 |
| Innodb_data_fsyncs | 27 |
| Innodb_data_pending_fsyncs | 0 |
| Innodb_data_pending_reads | 0 |
| Innodb_data_pending_writes | 0 |
| Innodb_data_read | 6113792 |
| Innodb_data_reads | 390 |
| Innodb_data_writes | 173 |
| Innodb_data_written | 2846208 |
| Innodb_dblwr_pages_written | 21 |
| Innodb_dblwr_writes | 3 |
| Innodb_log_waits | 0 |
| Innodb_log_write_requests | 5 |
| Innodb_log_writes | 12 |
| Innodb_os_log_fsyncs | 18 |
| Innodb_os_log_pending_fsyncs | 0 |
| Innodb_os_log_pending_writes | 0 |
| Innodb_os_log_written | 8704 |
| Innodb_page_size | 16384 |
| Innodb_pages_created | 131 |
| Innodb_pages_read | 368 |
| Innodb_pages0_read | 11 |
| Innodb_pages_written | 152 |
| Innodb_row_lock_current_waits | 0 |
| Innodb_row_lock_time | 0 |
| Innodb_row_lock_time_avg | 0 |
| Innodb_row_lock_time_max | 0 |
| Innodb_row_lock_waits | 0 |
| Innodb_rows_deleted | 0 |
| Innodb_rows_inserted | 0 |
| Innodb_rows_read | 125 |
| Innodb_rows_updated | 1 |
| Innodb_system_rows_deleted | 0 |
| Innodb_system_rows_inserted | 0 |
| Innodb_system_rows_read | 0 |
| Innodb_system_rows_updated | 0 |
| Innodb_num_open_files | 13 |
| Innodb_truncated_status_writes | 0 |
| Innodb_available_undo_logs | 128 |
| Innodb_undo_truncations | 0 |
| Innodb_page_compression_saved | 0 |
| Innodb_num_index_pages_written | 0 |
| Innodb_num_non_index_pages_written | 0 |
| Innodb_num_pages_page_compressed | 0 |
| Innodb_num_page_compressed_trim_op | 0 |
| Innodb_num_pages_page_decompressed | 0 |
| Innodb_num_pages_page_compression_error | 0 |
| Innodb_num_pages_encrypted | 0 |
| Innodb_num_pages_decrypted | 0 |
| Innodb_have_lz4 | OFF |
| Innodb_have_lzo | OFF |
| Innodb_have_lzma | OFF |
| Innodb_have_bzip2 | OFF |
| Innodb_have_snappy | OFF |
| Innodb_have_punch_hole | OFF |
| Innodb_defragment_compression_failures | 0 |
| Innodb_defragment_failures | 0 |
| Innodb_defragment_count | 0 |
| Innodb_onlineddl_rowlog_rows | 0 |
| Innodb_onlineddl_rowlog_pct_used | 0 |
| Innodb_onlineddl_pct_progress | 0 |
| Innodb_secondary_index_triggered_cluster_reads | 0 |
| Innodb_secondary_index_triggered_cluster_reads_avoided | 0 |
| Innodb_encryption_rotation_pages_read_from_cache | 0 |
| Innodb_encryption_rotation_pages_read_from_disk | 0 |
| Innodb_encryption_rotation_pages_modified | 0 |
| Innodb_encryption_rotation_pages_flushed | 0 |
| Innodb_encryption_rotation_estimated_iops | 0 |
| Innodb_encryption_key_rotation_list_length | 0 |
| Innodb_encryption_n_merge_blocks_encrypted | 0 |
| Innodb_encryption_n_merge_blocks_decrypted | 0 |
| Innodb_encryption_n_rowlog_blocks_encrypted | 0 |
| Innodb_encryption_n_rowlog_blocks_decrypted | 0 |
| Innodb_scrub_background_page_reorganizations | 0 |
| Innodb_scrub_background_page_splits | 0 |
| Innodb_scrub_background_page_split_failures_underflow | 0 |
| Innodb_scrub_background_page_split_failures_out_of_filespace | 0 |
| Innodb_scrub_background_page_split_failures_missing_index | 0 |
| Innodb_scrub_background_page_split_failures_unknown | 0 |
| Innodb_scrub_log | 0 |
| Innodb_encryption_num_key_requests | 0 |
| Key_blocks_not_flushed | 0 |
| Key_blocks_unused | 107138 |
| Key_blocks_used | 25 |
| Key_blocks_warm | 0 |
| Key_read_requests | 61 |
| Key_reads | 12 |
| Key_write_requests | 21 |
| Key_writes | 17 |
| Last_query_cost | 0.000000 |
| Master_gtid_wait_count | 0 |
| Master_gtid_wait_time | 0 |
| Master_gtid_wait_timeouts | 0 |
| Max_statement_time_exceeded | 0 |
| Max_used_connections | 3 |
| Memory_used | 291178416 |
| Not_flushed_delayed_rows | 0 |
| Open_files | 39 |
| Open_streams | 0 |
| Open_table_definitions | 31 |
| Open_tables | 24 |
| Opened_files | 111 |
| Opened_plugin_libraries | 0 |
| Opened_table_definitions | 31 |
| Opened_tables | 31 |
| Opened_views | 0 |
| Performance_schema_accounts_lost | 0 |
| Performance_schema_cond_classes_lost | 0 |
| Performance_schema_cond_instances_lost | 0 |
| Performance_schema_digest_lost | 0 |
| Performance_schema_file_classes_lost | 0 |
| Performance_schema_file_handles_lost | 0 |
| Performance_schema_file_instances_lost | 0 |
| Performance_schema_hosts_lost | 0 |
| Performance_schema_locker_lost | 0 |
| Performance_schema_mutex_classes_lost | 0 |
| Performance_schema_mutex_instances_lost | 0 |
| Performance_schema_rwlock_classes_lost | 0 |
| Performance_schema_rwlock_instances_lost | 0 |
| Performance_schema_session_connect_attrs_lost | 0 |
| Performance_schema_socket_classes_lost | 0 |
| Performance_schema_socket_instances_lost | 0 |
| Performance_schema_stage_classes_lost | 0 |
| Performance_schema_statement_classes_lost | 0 |
| Performance_schema_table_handles_lost | 0 |
| Performance_schema_table_instances_lost | 0 |
| Performance_schema_thread_classes_lost | 0 |
| Performance_schema_thread_instances_lost | 0 |
| Performance_schema_users_lost | 0 |
| Prepared_stmt_count | 0 |
| Qcache_free_blocks | 1 |
| Qcache_free_memory | 1031336 |
| Qcache_hits | 0 |
| Qcache_inserts | 0 |
| Qcache_lowmem_prunes | 0 |
| Qcache_not_cached | 0 |
| Qcache_queries_in_cache | 0 |
| Qcache_total_blocks | 1 |
| Queries | 182 |
| Questions | 182 |
| Rows_read | 189 |
| Rows_sent | 10893 |
| Rows_tmp_read | 10728 |
| Rpl_status | AUTH_MASTER |
| Select_full_join | 0 |
| Select_full_range_join | 0 |
| Select_range | 0 |
| Select_range_check | 0 |
| Select_scan | 73 |
| Slave_connections | 0 |
| Slave_heartbeat_period | 0.000 |
| Slave_open_temp_tables | 0 |
| Slave_received_heartbeats | 0 |
| Slave_retried_transactions | 0 |
| Slave_running | OFF |
| Slave_skipped_errors | 0 |
| Slaves_connected | 0 |
| Slaves_running | 0 |
| Slow_launch_threads | 0 |
| Slow_queries | 0 |
| Sort_merge_passes | 0 |
| Sort_priority_queue_sorts | 0 |
| Sort_range | 0 |
| Sort_rows | 0 |
| Sort_scan | 0 |
| Ssl_accept_renegotiates | 0 |
| Ssl_accepts | 0 |
| Ssl_callback_cache_hits | 0 |
| Ssl_cipher | |
| Ssl_cipher_list | |
| Ssl_client_connects | 0 |
| Ssl_connect_renegotiates | 0 |
| Ssl_ctx_verify_depth | 0 |
| Ssl_ctx_verify_mode | 0 |
| Ssl_default_timeout | 0 |
| Ssl_finished_accepts | 0 |
| Ssl_finished_connects | 0 |
| Ssl_server_not_after | |
| Ssl_server_not_before | |
| Ssl_session_cache_hits | 0 |
| Ssl_session_cache_misses | 0 |
| Ssl_session_cache_mode | NONE |
| Ssl_session_cache_overflows | 0 |
| Ssl_session_cache_size | 0 |
| Ssl_session_cache_timeouts | 0 |
| Ssl_sessions_reused | 0 |
| Ssl_used_session_cache_entries | 0 |
| Ssl_verify_depth | 0 |
| Ssl_verify_mode | 0 |
| Ssl_version | |
| Subquery_cache_hit | 0 |
| Subquery_cache_miss | 0 |
| Syncs | 2 |
| Table_locks_immediate | 80 |
| Table_locks_waited | 0 |
| Tc_log_max_pages_used | 0 |
| Tc_log_page_size | 4096 |
| Tc_log_page_waits | 0 |
| Threadpool_idle_threads | 0 |
| Threadpool_threads | 0 |
| Threads_cached | 0 |
| Threads_connected | 3 |
| Threads_created | 4 |
| Threads_running | 1 |
| Update_scan | 1 |
| Uptime | 29144 |
| Uptime_since_flush_status | 29144 |
| wsrep_cluster_conf_id | 18446744073709551615 |
| wsrep_cluster_size | 0 |
| wsrep_cluster_state_uuid | |
| wsrep_cluster_status | Disconnected |
| wsrep_connected | OFF |
| wsrep_local_bf_aborts | 0 |
| wsrep_local_index | 18446744073709551615 |
| wsrep_provider_name | |
| wsrep_provider_vendor | |
| wsrep_provider_version | |
| wsrep_ready | OFF |
| wsrep_thread_count | 0 |
+--------------------------------------------------------------+--------------------------------------------------+
484 rows in set (0.00 sec) MariaDB [yinzhengjie]>
MariaDB [yinzhengjie]>

MariaDB [yinzhengjie]> SHOW GLOBAL STATUS;         #查看全局状态变量

MariaDB [yinzhengjie]> SHOW SESSION STATUS;                                #查看会话状态变量
+--------------------------------------------------------------+--------------------------------------------------+
| Variable_name | Value |
+--------------------------------------------------------------+--------------------------------------------------+
| Aborted_clients | 0 |
| Aborted_connects | 4 |
| Access_denied_errors | 0 |
| Acl_column_grants | 2 |
| Acl_database_grants | 1 |
| Acl_function_grants | 0 |
| Acl_procedure_grants | 0 |
| Acl_proxy_users | 2 |
| Acl_role_grants | 0 |
| Acl_roles | 0 |
| Acl_table_grants | 1 |
| Acl_users | 5 |
| Aria_pagecache_blocks_not_flushed | 0 |
| Aria_pagecache_blocks_unused | 15706 |
| Aria_pagecache_blocks_used | 2 |
| Aria_pagecache_read_requests | 12 |
| Aria_pagecache_reads | 2 |
| Aria_pagecache_write_requests | 4 |
| Aria_pagecache_writes | 0 |
| Aria_transaction_log_syncs | 0 |
| Binlog_commits | 0 |
| Binlog_group_commits | 0 |
| Binlog_group_commit_trigger_count | 0 |
| Binlog_group_commit_trigger_lock_wait | 0 |
| Binlog_group_commit_trigger_timeout | 0 |
| Binlog_snapshot_file | |
| Binlog_snapshot_position | 0 |
| Binlog_bytes_written | 0 |
| Binlog_cache_disk_use | 0 |
| Binlog_cache_use | 0 |
| Binlog_stmt_cache_disk_use | 0 |
| Binlog_stmt_cache_use | 0 |
| Busy_time | 0.000000 |
| Bytes_received | 2965 |
| Bytes_sent | 388511 |
| Com_admin_commands | 0 |
| Com_alter_db | 0 |
| Com_alter_db_upgrade | 0 |
| Com_alter_event | 0 |
| Com_alter_function | 0 |
| Com_alter_procedure | 0 |
| Com_alter_server | 0 |
| Com_alter_table | 0 |
| Com_alter_tablespace | 0 |
| Com_alter_user | 0 |
| Com_analyze | 0 |
| Com_assign_to_keycache | 0 |
| Com_begin | 0 |
| Com_binlog | 0 |
| Com_call_procedure | 0 |
| Com_change_db | 2 |
| Com_change_master | 0 |
| Com_check | 0 |
| Com_checksum | 0 |
| Com_commit | 0 |
| Com_compound_sql | 0 |
| Com_create_db | 0 |
| Com_create_event | 0 |
| Com_create_function | 0 |
| Com_create_index | 0 |
| Com_create_procedure | 0 |
| Com_create_role | 0 |
| Com_create_server | 0 |
| Com_create_table | 0 |
| Com_create_temporary_table | 0 |
| Com_create_trigger | 0 |
| Com_create_udf | 0 |
| Com_create_user | 0 |
| Com_create_view | 0 |
| Com_dealloc_sql | 0 |
| Com_delete | 0 |
| Com_delete_multi | 0 |
| Com_do | 0 |
| Com_drop_db | 0 |
| Com_drop_event | 0 |
| Com_drop_function | 0 |
| Com_drop_index | 0 |
| Com_drop_procedure | 0 |
| Com_drop_role | 0 |
| Com_drop_server | 0 |
| Com_drop_table | 0 |
| Com_drop_temporary_table | 0 |
| Com_drop_trigger | 0 |
| Com_drop_user | 0 |
| Com_drop_view | 0 |
| Com_empty_query | 0 |
| Com_execute_immediate | 0 |
| Com_execute_sql | 0 |
| Com_flush | 1 |
| Com_get_diagnostics | 0 |
| Com_grant | 0 |
| Com_grant_role | 0 |
| Com_ha_close | 0 |
| Com_ha_open | 0 |
| Com_ha_read | 0 |
| Com_help | 2 |
| Com_insert | 0 |
| Com_insert_select | 0 |
| Com_install_plugin | 0 |
| Com_kill | 0 |
| Com_load | 0 |
| Com_lock_tables | 0 |
| Com_multi | 0 |
| Com_optimize | 0 |
| Com_preload_keys | 0 |
| Com_prepare_sql | 0 |
| Com_purge | 0 |
| Com_purge_before_date | 0 |
| Com_release_savepoint | 0 |
| Com_rename_table | 0 |
| Com_rename_user | 0 |
| Com_repair | 0 |
| Com_replace | 0 |
| Com_replace_select | 0 |
| Com_reset | 0 |
| Com_resignal | 0 |
| Com_revoke | 0 |
| Com_revoke_all | 0 |
| Com_revoke_role | 0 |
| Com_rollback | 0 |
| Com_rollback_to_savepoint | 0 |
| Com_savepoint | 0 |
| Com_select | 19 |
| Com_set_option | 11 |
| Com_show_authors | 0 |
| Com_show_binlog_events | 0 |
| Com_show_binlogs | 0 |
| Com_show_charsets | 0 |
| Com_show_collations | 0 |
| Com_show_contributors | 0 |
| Com_show_create_db | 0 |
| Com_show_create_event | 0 |
| Com_show_create_func | 0 |
| Com_show_create_proc | 0 |
| Com_show_create_table | 4 |
| Com_show_create_trigger | 0 |
| Com_show_create_user | 0 |
| Com_show_databases | 0 |
| Com_show_engine_logs | 0 |
| Com_show_engine_mutex | 0 |
| Com_show_engine_status | 0 |
| Com_show_errors | 0 |
| Com_show_events | 0 |
| Com_show_explain | 0 |
| Com_show_fields | 0 |
| Com_show_function_status | 0 |
| Com_show_generic | 0 |
| Com_show_grants | 0 |
| Com_show_keys | 0 |
| Com_show_master_status | 0 |
| Com_show_open_tables | 0 |
| Com_show_plugins | 0 |
| Com_show_privileges | 0 |
| Com_show_procedure_status | 0 |
| Com_show_processlist | 0 |
| Com_show_profile | 0 |
| Com_show_profiles | 0 |
| Com_show_relaylog_events | 0 |
| Com_show_slave_hosts | 0 |
| Com_show_slave_status | 0 |
| Com_show_status | 3 |
| Com_show_storage_engines | 0 |
| Com_show_table_status | 9 |
| Com_show_tables | 2 |
| Com_show_triggers | 0 |
| Com_show_variables | 27 |
| Com_show_warnings | 0 |
| Com_shutdown | 0 |
| Com_signal | 0 |
| Com_start_all_slaves | 0 |
| Com_start_slave | 0 |
| Com_stmt_close | 0 |
| Com_stmt_execute | 0 |
| Com_stmt_fetch | 0 |
| Com_stmt_prepare | 0 |
| Com_stmt_reprepare | 0 |
| Com_stmt_reset | 0 |
| Com_stmt_send_long_data | 0 |
| Com_stop_all_slaves | 0 |
| Com_stop_slave | 0 |
| Com_truncate | 0 |
| Com_uninstall_plugin | 0 |
| Com_unlock_tables | 0 |
| Com_update | 0 |
| Com_update_multi | 0 |
| Com_xa_commit | 0 |
| Com_xa_end | 0 |
| Com_xa_prepare | 0 |
| Com_xa_recover | 0 |
| Com_xa_rollback | 0 |
| Com_xa_start | 0 |
| Compression | OFF |
| Connection_errors_accept | 0 |
| Connection_errors_internal | 0 |
| Connection_errors_max_connections | 0 |
| Connection_errors_peer_address | 0 |
| Connection_errors_select | 0 |
| Connection_errors_tcpwrap | 0 |
| Connections | 17 |
| Cpu_time | 0.000000 |
| Created_tmp_disk_tables | 0 |
| Created_tmp_files | 5 |
| Created_tmp_tables | 38 |
| Delayed_errors | 0 |
| Delayed_insert_threads | 0 |
| Delayed_writes | 0 |
| Delete_scan | 0 |
| Empty_queries | 1 |
| Executed_events | 0 |
| Executed_triggers | 0 |
| Feature_check_constraint | 0 |
| Feature_delay_key_write | 0 |
| Feature_dynamic_columns | 0 |
| Feature_fulltext | 0 |
| Feature_gis | 0 |
| Feature_locale | 0 |
| Feature_subquery | 0 |
| Feature_timezone | 0 |
| Feature_trigger | 0 |
| Feature_window_functions | 0 |
| Feature_xml | 0 |
| Flush_commands | 1 |
| Handler_commit | 0 |
| Handler_delete | 0 |
| Handler_discover | 0 |
| Handler_external_lock | 0 |
| Handler_icp_attempts | 0 |
| Handler_icp_match | 0 |
| Handler_mrr_init | 0 |
| Handler_mrr_key_refills | 0 |
| Handler_mrr_rowid_refills | 0 |
| Handler_prepare | 0 |
| Handler_read_first | 2 |
| Handler_read_key | 3 |
| Handler_read_last | 0 |
| Handler_read_next | 3 |
| Handler_read_prev | 0 |
| Handler_read_retry | 0 |
| Handler_read_rnd | 0 |
| Handler_read_rnd_deleted | 1 |
| Handler_read_rnd_next | 10213 |
| Handler_rollback | 0 |
| Handler_savepoint | 0 |
| Handler_savepoint_rollback | 0 |
| Handler_tmp_update | 0 |
| Handler_tmp_write | 10164 |
| Handler_update | 0 |
| Handler_write | 0 |
| Innodb_buffer_pool_dump_status | |
| Innodb_buffer_pool_load_status | Buffer pool(s) load completed at 191029 7:20:21 |
| Innodb_buffer_pool_resize_status | |
| Innodb_buffer_pool_pages_data | 499 |
| Innodb_buffer_pool_bytes_data | 8175616 |
| Innodb_buffer_pool_pages_dirty | 0 |
| Innodb_buffer_pool_bytes_dirty | 0 |
| Innodb_buffer_pool_pages_flushed | 152 |
| Innodb_buffer_pool_pages_free | 7692 |
| Innodb_buffer_pool_pages_misc | 0 |
| Innodb_buffer_pool_pages_total | 8191 |
| Innodb_buffer_pool_read_ahead_rnd | 0 |
| Innodb_buffer_pool_read_ahead | 0 |
| Innodb_buffer_pool_read_ahead_evicted | 0 |
| Innodb_buffer_pool_read_requests | 2674 |
| Innodb_buffer_pool_reads | 369 |
| Innodb_buffer_pool_wait_free | 0 |
| Innodb_buffer_pool_write_requests | 1168 |
| Innodb_data_fsyncs | 27 |
| Innodb_data_pending_fsyncs | 0 |
| Innodb_data_pending_reads | 0 |
| Innodb_data_pending_writes | 0 |
| Innodb_data_read | 6113792 |
| Innodb_data_reads | 390 |
| Innodb_data_writes | 173 |
| Innodb_data_written | 2846208 |
| Innodb_dblwr_pages_written | 21 |
| Innodb_dblwr_writes | 3 |
| Innodb_log_waits | 0 |
| Innodb_log_write_requests | 5 |
| Innodb_log_writes | 12 |
| Innodb_os_log_fsyncs | 18 |
| Innodb_os_log_pending_fsyncs | 0 |
| Innodb_os_log_pending_writes | 0 |
| Innodb_os_log_written | 8704 |
| Innodb_page_size | 16384 |
| Innodb_pages_created | 131 |
| Innodb_pages_read | 368 |
| Innodb_pages0_read | 11 |
| Innodb_pages_written | 152 |
| Innodb_row_lock_current_waits | 0 |
| Innodb_row_lock_time | 0 |
| Innodb_row_lock_time_avg | 0 |
| Innodb_row_lock_time_max | 0 |
| Innodb_row_lock_waits | 0 |
| Innodb_rows_deleted | 0 |
| Innodb_rows_inserted | 0 |
| Innodb_rows_read | 125 |
| Innodb_rows_updated | 1 |
| Innodb_system_rows_deleted | 0 |
| Innodb_system_rows_inserted | 0 |
| Innodb_system_rows_read | 0 |
| Innodb_system_rows_updated | 0 |
| Innodb_num_open_files | 13 |
| Innodb_truncated_status_writes | 0 |
| Innodb_available_undo_logs | 128 |
| Innodb_undo_truncations | 0 |
| Innodb_page_compression_saved | 0 |
| Innodb_num_index_pages_written | 0 |
| Innodb_num_non_index_pages_written | 0 |
| Innodb_num_pages_page_compressed | 0 |
| Innodb_num_page_compressed_trim_op | 0 |
| Innodb_num_pages_page_decompressed | 0 |
| Innodb_num_pages_page_compression_error | 0 |
| Innodb_num_pages_encrypted | 0 |
| Innodb_num_pages_decrypted | 0 |
| Innodb_have_lz4 | OFF |
| Innodb_have_lzo | OFF |
| Innodb_have_lzma | OFF |
| Innodb_have_bzip2 | OFF |
| Innodb_have_snappy | OFF |
| Innodb_have_punch_hole | OFF |
| Innodb_defragment_compression_failures | 0 |
| Innodb_defragment_failures | 0 |
| Innodb_defragment_count | 0 |
| Innodb_onlineddl_rowlog_rows | 0 |
| Innodb_onlineddl_rowlog_pct_used | 0 |
| Innodb_onlineddl_pct_progress | 0 |
| Innodb_secondary_index_triggered_cluster_reads | 0 |
| Innodb_secondary_index_triggered_cluster_reads_avoided | 0 |
| Innodb_encryption_rotation_pages_read_from_cache | 0 |
| Innodb_encryption_rotation_pages_read_from_disk | 0 |
| Innodb_encryption_rotation_pages_modified | 0 |
| Innodb_encryption_rotation_pages_flushed | 0 |
| Innodb_encryption_rotation_estimated_iops | 0 |
| Innodb_encryption_key_rotation_list_length | 0 |
| Innodb_encryption_n_merge_blocks_encrypted | 0 |
| Innodb_encryption_n_merge_blocks_decrypted | 0 |
| Innodb_encryption_n_rowlog_blocks_encrypted | 0 |
| Innodb_encryption_n_rowlog_blocks_decrypted | 0 |
| Innodb_scrub_background_page_reorganizations | 0 |
| Innodb_scrub_background_page_splits | 0 |
| Innodb_scrub_background_page_split_failures_underflow | 0 |
| Innodb_scrub_background_page_split_failures_out_of_filespace | 0 |
| Innodb_scrub_background_page_split_failures_missing_index | 0 |
| Innodb_scrub_background_page_split_failures_unknown | 0 |
| Innodb_scrub_log | 0 |
| Innodb_encryption_num_key_requests | 0 |
| Key_blocks_not_flushed | 0 |
| Key_blocks_unused | 107138 |
| Key_blocks_used | 25 |
| Key_blocks_warm | 0 |
| Key_read_requests | 61 |
| Key_reads | 12 |
| Key_write_requests | 21 |
| Key_writes | 17 |
| Last_query_cost | 10.499000 |
| Master_gtid_wait_count | 0 |
| Master_gtid_wait_time | 0 |
| Master_gtid_wait_timeouts | 0 |
| Max_statement_time_exceeded | 0 |
| Max_used_connections | 3 |
| Memory_used | 68136 |
| Not_flushed_delayed_rows | 0 |
| Open_files | 39 |
| Open_streams | 0 |
| Open_table_definitions | 31 |
| Open_tables | 24 |
| Opened_files | 111 |
| Opened_plugin_libraries | 0 |
| Opened_table_definitions | 0 |
| Opened_tables | 0 |
| Opened_views | 0 |
| Performance_schema_accounts_lost | 0 |
| Performance_schema_cond_classes_lost | 0 |
| Performance_schema_cond_instances_lost | 0 |
| Performance_schema_digest_lost | 0 |
| Performance_schema_file_classes_lost | 0 |
| Performance_schema_file_handles_lost | 0 |
| Performance_schema_file_instances_lost | 0 |
| Performance_schema_hosts_lost | 0 |
| Performance_schema_locker_lost | 0 |
| Performance_schema_mutex_classes_lost | 0 |
| Performance_schema_mutex_instances_lost | 0 |
| Performance_schema_rwlock_classes_lost | 0 |
| Performance_schema_rwlock_instances_lost | 0 |
| Performance_schema_session_connect_attrs_lost | 0 |
| Performance_schema_socket_classes_lost | 0 |
| Performance_schema_socket_instances_lost | 0 |
| Performance_schema_stage_classes_lost | 0 |
| Performance_schema_statement_classes_lost | 0 |
| Performance_schema_table_handles_lost | 0 |
| Performance_schema_table_instances_lost | 0 |
| Performance_schema_thread_classes_lost | 0 |
| Performance_schema_thread_instances_lost | 0 |
| Performance_schema_users_lost | 0 |
| Prepared_stmt_count | 0 |
| Qcache_free_blocks | 1 |
| Qcache_free_memory | 1031336 |
| Qcache_hits | 0 |
| Qcache_inserts | 0 |
| Qcache_lowmem_prunes | 0 |
| Qcache_not_cached | 0 |
| Qcache_queries_in_cache | 0 |
| Qcache_total_blocks | 1 |
| Queries | 184 |
| Questions | 86 |
| Rows_read | 13 |
| Rows_sent | 10182 |
| Rows_tmp_read | 11132 |
| Rpl_status | AUTH_MASTER |
| Select_full_join | 0 |
| Select_full_range_join | 0 |
| Select_range | 0 |
| Select_range_check | 0 |
| Select_scan | 38 |
| Slave_connections | 0 |
| Slave_heartbeat_period | 0.000 |
| Slave_open_temp_tables | 0 |
| Slave_received_heartbeats | 0 |
| Slave_retried_transactions | 0 |
| Slave_running | OFF |
| Slave_skipped_errors | 0 |
| Slaves_connected | 0 |
| Slaves_running | 0 |
| Slow_launch_threads | 0 |
| Slow_queries | 0 |
| Sort_merge_passes | 0 |
| Sort_priority_queue_sorts | 0 |
| Sort_range | 0 |
| Sort_rows | 0 |
| Sort_scan | 0 |
| Ssl_accept_renegotiates | 0 |
| Ssl_accepts | 0 |
| Ssl_callback_cache_hits | 0 |
| Ssl_cipher | |
| Ssl_cipher_list | |
| Ssl_client_connects | 0 |
| Ssl_connect_renegotiates | 0 |
| Ssl_ctx_verify_depth | 0 |
| Ssl_ctx_verify_mode | 0 |
| Ssl_default_timeout | 0 |
| Ssl_finished_accepts | 0 |
| Ssl_finished_connects | 0 |
| Ssl_server_not_after | |
| Ssl_server_not_before | |
| Ssl_session_cache_hits | 0 |
| Ssl_session_cache_misses | 0 |
| Ssl_session_cache_mode | NONE |
| Ssl_session_cache_overflows | 0 |
| Ssl_session_cache_size | 0 |
| Ssl_session_cache_timeouts | 0 |
| Ssl_sessions_reused | 0 |
| Ssl_used_session_cache_entries | 0 |
| Ssl_verify_depth | 0 |
| Ssl_verify_mode | 0 |
| Ssl_version | |
| Subquery_cache_hit | 0 |
| Subquery_cache_miss | 0 |
| Syncs | 2 |
| Table_locks_immediate | 80 |
| Table_locks_waited | 0 |
| Tc_log_max_pages_used | 0 |
| Tc_log_page_size | 4096 |
| Tc_log_page_waits | 0 |
| Threadpool_idle_threads | 0 |
| Threadpool_threads | 0 |
| Threads_cached | 0 |
| Threads_connected | 3 |
| Threads_created | 4 |
| Threads_running | 1 |
| Update_scan | 0 |
| Uptime | 29215 |
| Uptime_since_flush_status | 29215 |
| wsrep_cluster_conf_id | 18446744073709551615 |
| wsrep_cluster_size | 0 |
| wsrep_cluster_state_uuid | |
| wsrep_cluster_status | Disconnected |
| wsrep_connected | OFF |
| wsrep_local_bf_aborts | 0 |
| wsrep_local_index | 18446744073709551615 |
| wsrep_provider_name | |
| wsrep_provider_vendor | |
| wsrep_provider_version | |
| wsrep_ready | OFF |
| wsrep_thread_count | 0 |
+--------------------------------------------------------------+--------------------------------------------------+
484 rows in set (0.00 sec) MariaDB [yinzhengjie]>

MariaDB [yinzhengjie]> SHOW SESSION STATUS;         #查看会话状态变量,此处的SESSION可以省略不写。

MariaDB [yinzhengjie]> SHOW STATUS;                           #查看会话状态变量
+--------------------------------------------------------------+--------------------------------------------------+
| Variable_name | Value |
+--------------------------------------------------------------+--------------------------------------------------+
| Aborted_clients | 0 |
| Aborted_connects | 4 |
| Access_denied_errors | 0 |
| Acl_column_grants | 2 |
| Acl_database_grants | 1 |
| Acl_function_grants | 0 |
| Acl_procedure_grants | 0 |
| Acl_proxy_users | 2 |
| Acl_role_grants | 0 |
| Acl_roles | 0 |
| Acl_table_grants | 1 |
| Acl_users | 5 |
| Aria_pagecache_blocks_not_flushed | 0 |
| Aria_pagecache_blocks_unused | 15706 |
| Aria_pagecache_blocks_used | 2 |
| Aria_pagecache_read_requests | 12 |
| Aria_pagecache_reads | 2 |
| Aria_pagecache_write_requests | 4 |
| Aria_pagecache_writes | 0 |
| Aria_transaction_log_syncs | 0 |
| Binlog_commits | 0 |
| Binlog_group_commits | 0 |
| Binlog_group_commit_trigger_count | 0 |
| Binlog_group_commit_trigger_lock_wait | 0 |
| Binlog_group_commit_trigger_timeout | 0 |
| Binlog_snapshot_file | |
| Binlog_snapshot_position | 0 |
| Binlog_bytes_written | 0 |
| Binlog_cache_disk_use | 0 |
| Binlog_cache_use | 0 |
| Binlog_stmt_cache_disk_use | 0 |
| Binlog_stmt_cache_use | 0 |
| Busy_time | 0.000000 |
| Bytes_received | 2981 |
| Bytes_sent | 402286 |
| Com_admin_commands | 0 |
| Com_alter_db | 0 |
| Com_alter_db_upgrade | 0 |
| Com_alter_event | 0 |
| Com_alter_function | 0 |
| Com_alter_procedure | 0 |
| Com_alter_server | 0 |
| Com_alter_table | 0 |
| Com_alter_tablespace | 0 |
| Com_alter_user | 0 |
| Com_analyze | 0 |
| Com_assign_to_keycache | 0 |
| Com_begin | 0 |
| Com_binlog | 0 |
| Com_call_procedure | 0 |
| Com_change_db | 2 |
| Com_change_master | 0 |
| Com_check | 0 |
| Com_checksum | 0 |
| Com_commit | 0 |
| Com_compound_sql | 0 |
| Com_create_db | 0 |
| Com_create_event | 0 |
| Com_create_function | 0 |
| Com_create_index | 0 |
| Com_create_procedure | 0 |
| Com_create_role | 0 |
| Com_create_server | 0 |
| Com_create_table | 0 |
| Com_create_temporary_table | 0 |
| Com_create_trigger | 0 |
| Com_create_udf | 0 |
| Com_create_user | 0 |
| Com_create_view | 0 |
| Com_dealloc_sql | 0 |
| Com_delete | 0 |
| Com_delete_multi | 0 |
| Com_do | 0 |
| Com_drop_db | 0 |
| Com_drop_event | 0 |
| Com_drop_function | 0 |
| Com_drop_index | 0 |
| Com_drop_procedure | 0 |
| Com_drop_role | 0 |
| Com_drop_server | 0 |
| Com_drop_table | 0 |
| Com_drop_temporary_table | 0 |
| Com_drop_trigger | 0 |
| Com_drop_user | 0 |
| Com_drop_view | 0 |
| Com_empty_query | 0 |
| Com_execute_immediate | 0 |
| Com_execute_sql | 0 |
| Com_flush | 1 |
| Com_get_diagnostics | 0 |
| Com_grant | 0 |
| Com_grant_role | 0 |
| Com_ha_close | 0 |
| Com_ha_open | 0 |
| Com_ha_read | 0 |
| Com_help | 2 |
| Com_insert | 0 |
| Com_insert_select | 0 |
| Com_install_plugin | 0 |
| Com_kill | 0 |
| Com_load | 0 |
| Com_lock_tables | 0 |
| Com_multi | 0 |
| Com_optimize | 0 |
| Com_preload_keys | 0 |
| Com_prepare_sql | 0 |
| Com_purge | 0 |
| Com_purge_before_date | 0 |
| Com_release_savepoint | 0 |
| Com_rename_table | 0 |
| Com_rename_user | 0 |
| Com_repair | 0 |
| Com_replace | 0 |
| Com_replace_select | 0 |
| Com_reset | 0 |
| Com_resignal | 0 |
| Com_revoke | 0 |
| Com_revoke_all | 0 |
| Com_revoke_role | 0 |
| Com_rollback | 0 |
| Com_rollback_to_savepoint | 0 |
| Com_savepoint | 0 |
| Com_select | 19 |
| Com_set_option | 11 |
| Com_show_authors | 0 |
| Com_show_binlog_events | 0 |
| Com_show_binlogs | 0 |
| Com_show_charsets | 0 |
| Com_show_collations | 0 |
| Com_show_contributors | 0 |
| Com_show_create_db | 0 |
| Com_show_create_event | 0 |
| Com_show_create_func | 0 |
| Com_show_create_proc | 0 |
| Com_show_create_table | 4 |
| Com_show_create_trigger | 0 |
| Com_show_create_user | 0 |
| Com_show_databases | 0 |
| Com_show_engine_logs | 0 |
| Com_show_engine_mutex | 0 |
| Com_show_engine_status | 0 |
| Com_show_errors | 0 |
| Com_show_events | 0 |
| Com_show_explain | 0 |
| Com_show_fields | 0 |
| Com_show_function_status | 0 |
| Com_show_generic | 0 |
| Com_show_grants | 0 |
| Com_show_keys | 0 |
| Com_show_master_status | 0 |
| Com_show_open_tables | 0 |
| Com_show_plugins | 0 |
| Com_show_privileges | 0 |
| Com_show_procedure_status | 0 |
| Com_show_processlist | 0 |
| Com_show_profile | 0 |
| Com_show_profiles | 0 |
| Com_show_relaylog_events | 0 |
| Com_show_slave_hosts | 0 |
| Com_show_slave_status | 0 |
| Com_show_status | 4 |
| Com_show_storage_engines | 0 |
| Com_show_table_status | 9 |
| Com_show_tables | 2 |
| Com_show_triggers | 0 |
| Com_show_variables | 27 |
| Com_show_warnings | 0 |
| Com_shutdown | 0 |
| Com_signal | 0 |
| Com_start_all_slaves | 0 |
| Com_start_slave | 0 |
| Com_stmt_close | 0 |
| Com_stmt_execute | 0 |
| Com_stmt_fetch | 0 |
| Com_stmt_prepare | 0 |
| Com_stmt_reprepare | 0 |
| Com_stmt_reset | 0 |
| Com_stmt_send_long_data | 0 |
| Com_stop_all_slaves | 0 |
| Com_stop_slave | 0 |
| Com_truncate | 0 |
| Com_uninstall_plugin | 0 |
| Com_unlock_tables | 0 |
| Com_update | 0 |
| Com_update_multi | 0 |
| Com_xa_commit | 0 |
| Com_xa_end | 0 |
| Com_xa_prepare | 0 |
| Com_xa_recover | 0 |
| Com_xa_rollback | 0 |
| Com_xa_start | 0 |
| Compression | OFF |
| Connection_errors_accept | 0 |
| Connection_errors_internal | 0 |
| Connection_errors_max_connections | 0 |
| Connection_errors_peer_address | 0 |
| Connection_errors_select | 0 |
| Connection_errors_tcpwrap | 0 |
| Connections | 17 |
| Cpu_time | 0.000000 |
| Created_tmp_disk_tables | 0 |
| Created_tmp_files | 5 |
| Created_tmp_tables | 38 |
| Delayed_errors | 0 |
| Delayed_insert_threads | 0 |
| Delayed_writes | 0 |
| Delete_scan | 0 |
| Empty_queries | 1 |
| Executed_events | 0 |
| Executed_triggers | 0 |
| Feature_check_constraint | 0 |
| Feature_delay_key_write | 0 |
| Feature_dynamic_columns | 0 |
| Feature_fulltext | 0 |
| Feature_gis | 0 |
| Feature_locale | 0 |
| Feature_subquery | 0 |
| Feature_timezone | 0 |
| Feature_trigger | 0 |
| Feature_window_functions | 0 |
| Feature_xml | 0 |
| Flush_commands | 1 |
| Handler_commit | 0 |
| Handler_delete | 0 |
| Handler_discover | 0 |
| Handler_external_lock | 0 |
| Handler_icp_attempts | 0 |
| Handler_icp_match | 0 |
| Handler_mrr_init | 0 |
| Handler_mrr_key_refills | 0 |
| Handler_mrr_rowid_refills | 0 |
| Handler_prepare | 0 |
| Handler_read_first | 2 |
| Handler_read_key | 3 |
| Handler_read_last | 0 |
| Handler_read_next | 3 |
| Handler_read_prev | 0 |
| Handler_read_retry | 0 |
| Handler_read_rnd | 0 |
| Handler_read_rnd_deleted | 1 |
| Handler_read_rnd_next | 10213 |
| Handler_rollback | 0 |
| Handler_savepoint | 0 |
| Handler_savepoint_rollback | 0 |
| Handler_tmp_update | 0 |
| Handler_tmp_write | 10164 |
| Handler_update | 0 |
| Handler_write | 0 |
| Innodb_buffer_pool_dump_status | |
| Innodb_buffer_pool_load_status | Buffer pool(s) load completed at 191029 7:20:21 |
| Innodb_buffer_pool_resize_status | |
| Innodb_buffer_pool_pages_data | 499 |
| Innodb_buffer_pool_bytes_data | 8175616 |
| Innodb_buffer_pool_pages_dirty | 0 |
| Innodb_buffer_pool_bytes_dirty | 0 |
| Innodb_buffer_pool_pages_flushed | 152 |
| Innodb_buffer_pool_pages_free | 7692 |
| Innodb_buffer_pool_pages_misc | 0 |
| Innodb_buffer_pool_pages_total | 8191 |
| Innodb_buffer_pool_read_ahead_rnd | 0 |
| Innodb_buffer_pool_read_ahead | 0 |
| Innodb_buffer_pool_read_ahead_evicted | 0 |
| Innodb_buffer_pool_read_requests | 2674 |
| Innodb_buffer_pool_reads | 369 |
| Innodb_buffer_pool_wait_free | 0 |
| Innodb_buffer_pool_write_requests | 1168 |
| Innodb_data_fsyncs | 27 |
| Innodb_data_pending_fsyncs | 0 |
| Innodb_data_pending_reads | 0 |
| Innodb_data_pending_writes | 0 |
| Innodb_data_read | 6113792 |
| Innodb_data_reads | 390 |
| Innodb_data_writes | 173 |
| Innodb_data_written | 2846208 |
| Innodb_dblwr_pages_written | 21 |
| Innodb_dblwr_writes | 3 |
| Innodb_log_waits | 0 |
| Innodb_log_write_requests | 5 |
| Innodb_log_writes | 12 |
| Innodb_os_log_fsyncs | 18 |
| Innodb_os_log_pending_fsyncs | 0 |
| Innodb_os_log_pending_writes | 0 |
| Innodb_os_log_written | 8704 |
| Innodb_page_size | 16384 |
| Innodb_pages_created | 131 |
| Innodb_pages_read | 368 |
| Innodb_pages0_read | 11 |
| Innodb_pages_written | 152 |
| Innodb_row_lock_current_waits | 0 |
| Innodb_row_lock_time | 0 |
| Innodb_row_lock_time_avg | 0 |
| Innodb_row_lock_time_max | 0 |
| Innodb_row_lock_waits | 0 |
| Innodb_rows_deleted | 0 |
| Innodb_rows_inserted | 0 |
| Innodb_rows_read | 125 |
| Innodb_rows_updated | 1 |
| Innodb_system_rows_deleted | 0 |
| Innodb_system_rows_inserted | 0 |
| Innodb_system_rows_read | 0 |
| Innodb_system_rows_updated | 0 |
| Innodb_num_open_files | 13 |
| Innodb_truncated_status_writes | 0 |
| Innodb_available_undo_logs | 128 |
| Innodb_undo_truncations | 0 |
| Innodb_page_compression_saved | 0 |
| Innodb_num_index_pages_written | 0 |
| Innodb_num_non_index_pages_written | 0 |
| Innodb_num_pages_page_compressed | 0 |
| Innodb_num_page_compressed_trim_op | 0 |
| Innodb_num_pages_page_decompressed | 0 |
| Innodb_num_pages_page_compression_error | 0 |
| Innodb_num_pages_encrypted | 0 |
| Innodb_num_pages_decrypted | 0 |
| Innodb_have_lz4 | OFF |
| Innodb_have_lzo | OFF |
| Innodb_have_lzma | OFF |
| Innodb_have_bzip2 | OFF |
| Innodb_have_snappy | OFF |
| Innodb_have_punch_hole | OFF |
| Innodb_defragment_compression_failures | 0 |
| Innodb_defragment_failures | 0 |
| Innodb_defragment_count | 0 |
| Innodb_onlineddl_rowlog_rows | 0 |
| Innodb_onlineddl_rowlog_pct_used | 0 |
| Innodb_onlineddl_pct_progress | 0 |
| Innodb_secondary_index_triggered_cluster_reads | 0 |
| Innodb_secondary_index_triggered_cluster_reads_avoided | 0 |
| Innodb_encryption_rotation_pages_read_from_cache | 0 |
| Innodb_encryption_rotation_pages_read_from_disk | 0 |
| Innodb_encryption_rotation_pages_modified | 0 |
| Innodb_encryption_rotation_pages_flushed | 0 |
| Innodb_encryption_rotation_estimated_iops | 0 |
| Innodb_encryption_key_rotation_list_length | 0 |
| Innodb_encryption_n_merge_blocks_encrypted | 0 |
| Innodb_encryption_n_merge_blocks_decrypted | 0 |
| Innodb_encryption_n_rowlog_blocks_encrypted | 0 |
| Innodb_encryption_n_rowlog_blocks_decrypted | 0 |
| Innodb_scrub_background_page_reorganizations | 0 |
| Innodb_scrub_background_page_splits | 0 |
| Innodb_scrub_background_page_split_failures_underflow | 0 |
| Innodb_scrub_background_page_split_failures_out_of_filespace | 0 |
| Innodb_scrub_background_page_split_failures_missing_index | 0 |
| Innodb_scrub_background_page_split_failures_unknown | 0 |
| Innodb_scrub_log | 0 |
| Innodb_encryption_num_key_requests | 0 |
| Key_blocks_not_flushed | 0 |
| Key_blocks_unused | 107138 |
| Key_blocks_used | 25 |
| Key_blocks_warm | 0 |
| Key_read_requests | 61 |
| Key_reads | 12 |
| Key_write_requests | 21 |
| Key_writes | 17 |
| Last_query_cost | 10.499000 |
| Master_gtid_wait_count | 0 |
| Master_gtid_wait_time | 0 |
| Master_gtid_wait_timeouts | 0 |
| Max_statement_time_exceeded | 0 |
| Max_used_connections | 3 |
| Memory_used | 68136 |
| Not_flushed_delayed_rows | 0 |
| Open_files | 39 |
| Open_streams | 0 |
| Open_table_definitions | 31 |
| Open_tables | 24 |
| Opened_files | 111 |
| Opened_plugin_libraries | 0 |
| Opened_table_definitions | 0 |
| Opened_tables | 0 |
| Opened_views | 0 |
| Performance_schema_accounts_lost | 0 |
| Performance_schema_cond_classes_lost | 0 |
| Performance_schema_cond_instances_lost | 0 |
| Performance_schema_digest_lost | 0 |
| Performance_schema_file_classes_lost | 0 |
| Performance_schema_file_handles_lost | 0 |
| Performance_schema_file_instances_lost | 0 |
| Performance_schema_hosts_lost | 0 |
| Performance_schema_locker_lost | 0 |
| Performance_schema_mutex_classes_lost | 0 |
| Performance_schema_mutex_instances_lost | 0 |
| Performance_schema_rwlock_classes_lost | 0 |
| Performance_schema_rwlock_instances_lost | 0 |
| Performance_schema_session_connect_attrs_lost | 0 |
| Performance_schema_socket_classes_lost | 0 |
| Performance_schema_socket_instances_lost | 0 |
| Performance_schema_stage_classes_lost | 0 |
| Performance_schema_statement_classes_lost | 0 |
| Performance_schema_table_handles_lost | 0 |
| Performance_schema_table_instances_lost | 0 |
| Performance_schema_thread_classes_lost | 0 |
| Performance_schema_thread_instances_lost | 0 |
| Performance_schema_users_lost | 0 |
| Prepared_stmt_count | 0 |
| Qcache_free_blocks | 1 |
| Qcache_free_memory | 1031336 |
| Qcache_hits | 0 |
| Qcache_inserts | 0 |
| Qcache_lowmem_prunes | 0 |
| Qcache_not_cached | 0 |
| Qcache_queries_in_cache | 0 |
| Qcache_total_blocks | 1 |
| Queries | 185 |
| Questions | 87 |
| Rows_read | 13 |
| Rows_sent | 10182 |
| Rows_tmp_read | 11616 |
| Rpl_status | AUTH_MASTER |
| Select_full_join | 0 |
| Select_full_range_join | 0 |
| Select_range | 0 |
| Select_range_check | 0 |
| Select_scan | 38 |
| Slave_connections | 0 |
| Slave_heartbeat_period | 0.000 |
| Slave_open_temp_tables | 0 |
| Slave_received_heartbeats | 0 |
| Slave_retried_transactions | 0 |
| Slave_running | OFF |
| Slave_skipped_errors | 0 |
| Slaves_connected | 0 |
| Slaves_running | 0 |
| Slow_launch_threads | 0 |
| Slow_queries | 0 |
| Sort_merge_passes | 0 |
| Sort_priority_queue_sorts | 0 |
| Sort_range | 0 |
| Sort_rows | 0 |
| Sort_scan | 0 |
| Ssl_accept_renegotiates | 0 |
| Ssl_accepts | 0 |
| Ssl_callback_cache_hits | 0 |
| Ssl_cipher | |
| Ssl_cipher_list | |
| Ssl_client_connects | 0 |
| Ssl_connect_renegotiates | 0 |
| Ssl_ctx_verify_depth | 0 |
| Ssl_ctx_verify_mode | 0 |
| Ssl_default_timeout | 0 |
| Ssl_finished_accepts | 0 |
| Ssl_finished_connects | 0 |
| Ssl_server_not_after | |
| Ssl_server_not_before | |
| Ssl_session_cache_hits | 0 |
| Ssl_session_cache_misses | 0 |
| Ssl_session_cache_mode | NONE |
| Ssl_session_cache_overflows | 0 |
| Ssl_session_cache_size | 0 |
| Ssl_session_cache_timeouts | 0 |
| Ssl_sessions_reused | 0 |
| Ssl_used_session_cache_entries | 0 |
| Ssl_verify_depth | 0 |
| Ssl_verify_mode | 0 |
| Ssl_version | |
| Subquery_cache_hit | 0 |
| Subquery_cache_miss | 0 |
| Syncs | 2 |
| Table_locks_immediate | 80 |
| Table_locks_waited | 0 |
| Tc_log_max_pages_used | 0 |
| Tc_log_page_size | 4096 |
| Tc_log_page_waits | 0 |
| Threadpool_idle_threads | 0 |
| Threadpool_threads | 0 |
| Threads_cached | 0 |
| Threads_connected | 3 |
| Threads_created | 4 |
| Threads_running | 1 |
| Update_scan | 0 |
| Uptime | 29263 |
| Uptime_since_flush_status | 29263 |
| wsrep_cluster_conf_id | 18446744073709551615 |
| wsrep_cluster_size | 0 |
| wsrep_cluster_state_uuid | |
| wsrep_cluster_status | Disconnected |
| wsrep_connected | OFF |
| wsrep_local_bf_aborts | 0 |
| wsrep_local_index | 18446744073709551615 |
| wsrep_provider_name | |
| wsrep_provider_vendor | |
| wsrep_provider_version | |
| wsrep_ready | OFF |
| wsrep_thread_count | 0 |
+--------------------------------------------------------------+--------------------------------------------------+
484 rows in set (0.00 sec) MariaDB [yinzhengjie]>
MariaDB [yinzhengjie]>

MariaDB [yinzhengjie]> SHOW STATUS;               #查看会话状态变量

MariaDB [yinzhengjie]> SHOW STATUS LIKE 'com_select';      #查看当前数据库执行查询的总次数
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| Com_select | 22 |
+---------------+-------+
1 row in set (0.00 sec) MariaDB [yinzhengjie]>
MariaDB [yinzhengjie]> SELECT * FROM students_info;        #此处我们故意执行一条查询语句
+------+-----------+
| id | name |
+------+-----------+
| 1 | 花果山 |
| 2 | 孙悟空 |
+------+-----------+
2 rows in set (0.00 sec) MariaDB [yinzhengjie]>
MariaDB [yinzhengjie]> INSERT INTO students_info VALUES (3,'孙大圣'),(4,'美猴王'),(5,'孙侯子');
Query OK, 3 rows affected (0.00 sec)
Records: 3 Duplicates: 0 Warnings: 0 MariaDB [yinzhengjie]>
MariaDB [yinzhengjie]> SHOW STATUS LIKE 'com_select';      #查看当前数据库执行查询的总次数
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| Com_select | 23 |
+---------------+-------+
1 row in set (0.00 sec) MariaDB [yinzhengjie]>
MariaDB [yinzhengjie]> UPDATE students_info SET name = 'Sun' WHERE id = 2;
Query OK, 1 row affected (0.01 sec)
Rows matched: 1 Changed: 1 Warnings: 0 MariaDB [yinzhengjie]>
MariaDB [yinzhengjie]> SHOW STATUS LIKE 'com_select';      #查看当前数据库执行查询的总次数
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| Com_select | 23 |
+---------------+-------+
1 row in set (0.00 sec) MariaDB [yinzhengjie]>
MariaDB [yinzhengjie]> SELECT * FROM students_info;
+------+-----------+
| id | name |
+------+-----------+
| 1 | 花果山 |
| 2 | Sun |
| 3 | 孙大圣 |
| 4 | 美猴王 |
| 5 | 孙侯子 |
+------+-----------+
5 rows in set (0.00 sec) MariaDB [yinzhengjie]>
MariaDB [yinzhengjie]> SELECT * FROM students_info;
+------+-----------+
| id | name |
+------+-----------+
| 1 | 花果山 |
| 2 | Sun |
| 3 | 孙大圣 |
| 4 | 美猴王 |
| 5 | 孙侯子 |
+------+-----------+
5 rows in set (0.00 sec) MariaDB [yinzhengjie]>
MariaDB [yinzhengjie]>
MariaDB [yinzhengjie]> SHOW STATUS LIKE 'com_select';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| Com_select | 25 |
+---------------+-------+
1 row in set (0.00 sec) MariaDB [yinzhengjie]>
MariaDB [yinzhengjie]> SET com_select = 100;      #该语句执行会报错,因为状态变量是只读的,我们无法进行修改操作。
ERROR 1193 (HY000): Unknown system variable 'com_select'
MariaDB [yinzhengjie]>

MariaDB [yinzhengjie]> SET com_select = 100;        #该语句执行会报错,因为状态变量是只读的,我们无法进行修改操作。

三.服务器变量SQL_MODE

1>.什么是SQL_MODE

  对其设置可以完成一些约束检查的工作,可分别进行全局的设置或当前会话的设置。

  博主推荐阅读:
    https://mariadb.com/kb/en/library/sql-mode/

2>.常见SQL_MODE

NO_AUTO_CREATE_USER
  禁止GRANT创建密码为空的用户 NO_ZERO_DATE
  在严格模式,不允许使用‘0000-00-00’的时间 ONLY_FULL_GROUP_BY
  对于GROUP BY聚合操作,如果在SELECT中的列,没有在GROUP BY中出现,那么将认为这个SQL是不合法的 NO_BACKSLASH_ESCAPES
  反斜杠“\”作为普通字符而非转义字符 PIPES_AS_CONCAT
  将"||"视为连接操作符而非“或运算符”
MariaDB [yinzhengjie]> SHOW VARIABLES LIKE 'sql_mode';
+---------------+-------------------------------------------------------------------------------------------+
| Variable_name | Value |
+---------------+-------------------------------------------------------------------------------------------+
| sql_mode | STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |
+---------------+-------------------------------------------------------------------------------------------+
1 row in set (0.00 sec) MariaDB [yinzhengjie]>

MariaDB [yinzhengjie]> SHOW VARIABLES LIKE 'sql_mode';

3>.SQL_MODE案例

MariaDB [yinzhengjie]> SHOW VARIABLES LIKE 'sql_mode';      #在mariaDB 10.2.x版本默认开启了SQL_MODE。
+---------------+-------------------------------------------------------------------------------------------+
| Variable_name | Value |
+---------------+-------------------------------------------------------------------------------------------+
| sql_mode | STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |
+---------------+-------------------------------------------------------------------------------------------+
1 row in set (0.00 sec) MariaDB [yinzhengjie]>
MariaDB [yinzhengjie]> SET SQL_MODE = '';             #此处我们故意清空MaraDB 10.2.x版本默认的SQL_MODE
Query OK, 0 rows affected (0.00 sec) MariaDB [yinzhengjie]>
MariaDB [yinzhengjie]> SHOW VARIABLES LIKE 'sql_mode';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| sql_mode | |
+---------------+-------+
1 row in set (0.00 sec) MariaDB [yinzhengjie]>

MariaDB [yinzhengjie]> SET SQL_MODE = '';             #此处我们故意清空MaraDB 10.2.x版本默认的SQL_MODE

MariaDB [yinzhengjie]> CREATE TABLE students_info(id INT,name CHAR(3));      #我们让name字段的属性仅能存储3个字符
Query OK, 0 rows affected (0.02 sec) MariaDB [yinzhengjie]>
MariaDB [yinzhengjie]> INSERT INTO students_info VALUES (1,'花果山水帘洞齐天大圣孙悟空');    #我们在插入的时候故意超过3个字符,虽然语句执行成功但有报警信息
Query OK, 1 row affected, 1 warning (0.01 sec)     MariaDB [yinzhengjie]>
MariaDB [yinzhengjie]> SHOW WARNINGS;    #上面的输出提示有一条warning信息,我们可以看到警告信息的详细内容,说是name列的字段被截断。
+---------+------+-------------------------------------------+
| Level | Code | Message |
+---------+------+-------------------------------------------+
| Warning | 1265 | Data truncated for column 'name' at row 1 |
+---------+------+-------------------------------------------+
row in set (0.00 sec) MariaDB [yinzhengjie]> SELECT * FROM students_info;    #此时我们查看数据是插入了,但是name列仅仅保存了3个字符,将我们原来插入的字符阶段保存啦!
+------+-----------+
| id | name |
+------+-----------+
| 1 | 花果山 |
+------+-----------+
row in set (0.00 sec) MariaDB [yinzhengjie]>
MariaDB [yinzhengjie]>
MariaDB [yinzhengjie]> SET SQL_MODE = 'traditional';    #此时我们故意修改SQL_MODE属性为传统模式
Query OK, 0 rows affected (0.00 sec) MariaDB [yinzhengjie]>
MariaDB [yinzhengjie]> SHOW VARIABLES LIKE 'sql_mode';    #发现此时SQL_MODE多出了一堆的属性值。
+---------------+--------------------------------------------------------------------------------------------------------------------------------
----------------------+| Variable_name | Value
|+---------------+--------------------------------------------------------------------------------------------------------------------------------
----------------------+| sql_mode | STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,N
O_ENGINE_SUBSTITUTION |+---------------+--------------------------------------------------------------------------------------------------------------------------------
----------------------+
1 row in set (0.00 sec) MariaDB [yinzhengjie]>
MariaDB [yinzhengjie]>
MariaDB [yinzhengjie]> INSERT INTO students_info VALUES (2,'花果山水帘洞齐天大圣孙悟空');    #当我们再次插入数据不会有警告信息而是直接报错啦,说是name这一列太长啦!
ERROR 1406 (22001): Data too long for column 'name' at row 1
MariaDB [yinzhengjie]>
MariaDB [yinzhengjie]> INSERT INTO students_info VALUES (2,'孙悟空');      #当我们对name这一列插入的字符串不超过3个字符时是可以正常写入的。
Query OK, 1 row affected (0.01 sec) MariaDB [yinzhengjie]>
MariaDB [yinzhengjie]> SELECT * FROM students_info;        #很显然,SQL_MODE可以强制检测插入的数据是否符合表中字段定义类型限制
+------+-----------+
| id | name |
+------+-----------+
| 1 | 花果山 |
| 2 | 孙悟空 |
+------+-----------+
rows in set (0.00 sec) MariaDB [yinzhengjie]>
MariaDB [yinzhengjie]>