Preface Since the release of the first official version of MySQL 8.0.11 in 2018, the MySQL version has been updated to 8.0.26. Compared with the stable version 5.7, the performance improvement of 8.0 is unquestionable! As more and more companies begin to use MySQL version 8.0, it is a challenge and an opportunity for DBAs! 💪🏻 This article mainly discusses the new features of MySQL 8.0: global parameter persistence Global parameter persistenceMySQL 8.0 supports online modification of global parameters and persistence. By adding the PERSIST keyword, the modified parameters can be persisted to a new configuration file (mysqld-auto.cnf). When you restart MySQL, you can get the latest configuration parameters from the configuration file!
To enable this feature, use the special syntax SET PERSIST to set any dynamically modifiable global variables!
The statement can modify the value of the variable in memory and write the modified value to mysqld-auto.cnf in the data directory.
The statement does not modify the value of the variable in memory, but only writes the modified value to mysqld-auto.cnf in the data directory. Take the max_connections parameter as an example: mysql> select * from performance_schema.persisted_variables; Empty set (0.00 sec) mysql> show variables like '%max_connections%'; +------------------------+-------+ | Variable_name | Value | +------------------------+-------+ | max_connections | 151 | |mysqlx_max_connections | 100 | +------------------------+-------+ 2 rows in set (0.00 sec) mysql> set persist max_connections=300; Query OK, 0 rows affected (0.00 sec) mysql> select * from performance_schema.persisted_variables; +-----------------+----------------+ | VARIABLE_NAME | VARIABLE_VALUE | +-----------------+----------------+ | max_connections | 300 | +-----------------+----------------+ 1 row in set (0.00 sec) The system will generate a mysqld-auto.cnf file in json format in the data directory. The format is as follows. When my.cnf and mysqld-auto.cnf exist at the same time, the latter has a higher priority. { "Version": 1, "mysql_server": { "max_connections": { "Value": "300", "Metadata": { "Timestamp": 1632575065787609, "User": "root", "Host": "localhost" } } } } 📢 Note: Even if you modify the configuration value through SET PERSIST and there is no change, it will be written to the mysqld-auto.cnf file. But you can restore the initial default value by setting it to the DEFAULT value! If you want to restore the max_connections parameter to its initial default value, just execute: mysql> set persist max_connections=DEFAULT; Query OK, 0 rows affected (0.00 sec) mysql> select * from performance_schema.persisted_variables; +-----------------+----------------+ | VARIABLE_NAME | VARIABLE_VALUE | +-----------------+----------------+ | max_connections | 151 | +-----------------+----------------+ 1 row in set (0.00 sec) If you want to remove all global persistent parameters, just execute: mysql> RESET PERSIST; Query OK, 0 rows affected (0.00 sec) mysql> select * from performance_schema.persisted_variables; Empty set (0.00 sec) Of course, you can also delete the mysqld-auto.cnf file and restart MySQL! Final Thoughts Main code: Commit f2bc0f89b7f94cc8fe963d08157413a01d14d994 Main entry function (8.0.0):
SummarizeThis is the end of this article about the new feature of MySQL 8: global parameter persistence. For more information about MySQL 8 global parameter persistence, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! Reference Documents:
You may also be interested in:
|
<<: avue-crud implementation example of multi-level complex dynamic header
Table of contents LAMP architecture 1.Lamp Introd...
The transaction log records the operations on the...
Firefox, Opera and other browsers do not support W...
Install TomCat on Windows This article will intro...
I received a task from the company today, and the...
1. What is Parallax scrolling refers to the movem...
1. All tags must have a corresponding end tag Prev...
Moreover, an article website built with a blog pro...
1. The div css mouse hand shape is cursor:pointer;...
1. Space rules Whitespace within HTML code is usu...
1. Inline elements only occupy the width of the co...
First, let's simulate the data coming from th...
I struggled with this for a long time, and after s...
mysql query with multiple conditions Environment:...
React originated as an internal project at Facebo...