Rechercher dans le manuel MySQL

13.7.6.39 SHOW VARIABLES Syntax

  1. SHOW [GLOBAL | SESSION] VARIABLES
  2.     [LIKE 'pattern' | WHERE expr]

SHOW VARIABLES shows the values of MySQL system variables (see Section 5.1.8, “Server System Variables”). This statement does not require any privilege. It requires only the ability to connect to the server.

System variable information is also available from these sources:

For SHOW VARIABLES, a LIKE clause, if present, indicates which variable names to match. A WHERE clause can be given to select rows using more general conditions, as discussed in Section 25.42, “Extensions to SHOW Statements”.

SHOW VARIABLES accepts an optional GLOBAL or SESSION variable scope modifier:

  • With a GLOBAL modifier, the statement displays global system variable values. These are the values used to initialize the corresponding session variables for new connections to MySQL. If a variable has no global value, no value is displayed.

  • With a SESSION modifier, the statement displays the system variable values that are in effect for the current connection. If a variable has no session value, the global value is displayed. LOCAL is a synonym for SESSION.

  • If no modifier is present, the default is SESSION.

The scope for each system variable is listed at Section 5.1.8, “Server System Variables”.

SHOW VARIABLES is subject to a version-dependent display-width limit. For variables with very long values that are not completely displayed, use SELECT as a workaround. For example:

  1. SELECT @@GLOBAL.innodb_data_file_path;

Most system variables can be set at server startup (read-only variables such as version_comment are exceptions). Many can be changed at runtime with the SET statement. See Section 5.1.9, “Using System Variables”, and Section 13.7.5.1, “SET Syntax for Variable Assignment”.

Partial output is shown here. The list of names and values may differ for your server. Section 5.1.8, “Server System Variables”, describes the meaning of each variable, and Section 5.1.1, “Configuring the Server”, provides information about tuning them.

  1. mysql> SHOW VARIABLES;
  2. +--------------------------------------------+------------------------------+
  3. | Variable_name                              | Value                        |
  4. +--------------------------------------------+------------------------------+
  5. | activate_all_roles_on_login                | OFF                          |
  6. | auto_generate_certs                        | ON                           |
  7. | auto_increment_increment                   | 1                            |
  8. | auto_increment_offset                      | 1                            |
  9. | autocommit                                 | ON                           |
  10. | automatic_sp_privileges                    | ON                           |
  11. | avoid_temporal_upgrade                     | OFF                          |
  12. | back_log                                   | 151                          |
  13. | basedir                                    | /usr/                        |
  14. | big_tables                                 | OFF                          |
  15. | bind_address                               | *                            |
  16. | binlog_cache_size                          | 32768                        |
  17. | binlog_checksum                            | CRC32                        |
  18. | binlog_direct_non_transactional_updates    | OFF                          |
  19. | binlog_error_action                        | ABORT_SERVER                 |
  20. | binlog_expire_logs_seconds                 | 2592000                      |
  21. | binlog_format                              | ROW                          |
  22. | binlog_group_commit_sync_delay             | 0                            |
  23. | binlog_group_commit_sync_no_delay_count    | 0                            |
  24. | binlog_gtid_simple_recovery                | ON                           |
  25. | binlog_max_flush_queue_time                | 0                            |
  26. | binlog_order_commits                       | ON                           |
  27. | binlog_row_image                           | FULL                         |
  28. | binlog_row_metadata                        | MINIMAL                      |
  29. | binlog_row_value_options                   |                              |
  30. | binlog_rows_query_log_events               | OFF                          |
  31. | binlog_stmt_cache_size                     | 32768                        |
  32. | binlog_transaction_dependency_history_size | 25000                        |
  33. | binlog_transaction_dependency_tracking     | COMMIT_ORDER                 |
  34. | block_encryption_mode                      | aes-128-ecb                  |
  35. | bulk_insert_buffer_size                    | 8388608                      |
  36.  
  37. ...
  38.  
  39. | max_allowed_packet                         | 67108864                     |
  40. | max_binlog_cache_size                      | 18446744073709547520         |
  41. | max_binlog_size                            | 1073741824                   |
  42. | max_binlog_stmt_cache_size                 | 18446744073709547520         |
  43. | max_connect_errors                         | 100                          |
  44. | max_connections                            | 151                          |
  45. | max_delayed_threads                        | 20                           |
  46. | max_digest_length                          | 1024                         |
  47. | max_error_count                            | 1024                         |
  48. | max_execution_time                         | 0                            |
  49. | max_heap_table_size                        | 16777216                     |
  50. | max_insert_delayed_threads                 | 20                           |
  51. | max_join_size                              | 18446744073709551615         |
  52.  
  53. ...
  54.  
  55. | thread_handling                            | one-thread-per-connection    |
  56. | thread_stack                               | 286720                       |
  57. | time_zone                                  | SYSTEM                       |
  58. | timestamp                                  | 1530906638.765316            |
  59. | tls_version                                | TLSv1,TLSv1.1,TLSv1.2        |
  60. | tmp_table_size                             | 16777216                     |
  61. | tmpdir                                     | /tmp                         |
  62. | transaction_alloc_block_size               | 8192                         |
  63. | transaction_allow_batching                 | OFF                          |
  64. | transaction_isolation                      | REPEATABLE-READ              |
  65. | transaction_prealloc_size                  | 4096                         |
  66. | transaction_read_only                      | OFF                          |
  67. | transaction_write_set_extraction           | XXHASH64                     |
  68. | unique_checks                              | ON                           |
  69. | updatable_views_with_limit                 | YES                          |
  70. | version                                    | 8.0.12                       |
  71. | version_comment                            | MySQL Community Server - GPL |
  72. | version_compile_machine                    | x86_64                       |
  73. | version_compile_os                         | Linux                        |
  74. | version_compile_zlib                       | 1.2.11                       |
  75. | wait_timeout                               | 28800                        |
  76. | warning_count                              | 0                            |
  77. | windowing_use_high_precision               | ON                           |
  78. +--------------------------------------------+------------------------------+

With a LIKE clause, the statement displays only rows for those variables with names that match the pattern. To obtain the row for a specific variable, use a LIKE clause as shown:

  1. SHOW VARIABLES LIKE 'max_join_size';
  2. SHOW SESSION VARIABLES LIKE 'max_join_size';

To get a list of variables whose name match a pattern, use the % wildcard character in a LIKE clause:

  1. SHOW VARIABLES LIKE '%size%';
  2. SHOW GLOBAL VARIABLES LIKE '%size%';

Wildcard characters can be used in any position within the pattern to be matched. Strictly speaking, because _ is a wildcard that matches any single character, you should escape it as \_ to match it literally. In practice, this is rarely necessary.


Find a PHP function

Document created the 26/06/2006, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/mysql-rf-show-variables.html

The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.

References

  1. View the html document Language of the document:en Manuel MySQL : https://dev.mysql.com/

These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.

Contents Haut