R
R
Rollex2021-06-12 18:02:46
MySQL
Rollex, 2021-06-12 18:02:46

How to save binlog_expire_logs_seconds?

Hello. I have on board

mysql Ver 8.0.23-14 for Linux on x86_64 (Percona Server (GPL), Release '14', Revision '3558242')

I can't figure out how to save the changed parameter, namely binlog_expire_logs_seconds.
In theory, the flush logs command should save it;
But after restarting mysql, the value always returns to the default number.
mysql> show global  variables like 'binlog_expire_logs_seconds';
+----------------------------+---------+
| Variable_name              | Value   |
+----------------------------+---------+
| binlog_expire_logs_seconds | 2592000 |
+----------------------------+---------+
1 row in set (0.02 sec)

mysql> SET GLOBAL binlog_expire_logs_seconds = 432000;
Query OK, 0 rows affected (0.00 sec)

mysql> show global  variables like 'binlog_expire_logs_seconds';
+----------------------------+--------+
| Variable_name              | Value  |
+----------------------------+--------+
| binlog_expire_logs_seconds | 432000 |
+----------------------------+--------+
1 row in set (0.00 sec)

mysql> flush logs;
Query OK, 0 rows affected (0.02 sec)

mysql> exit

# systemctl restart mysql.service
# mysql -uroot -p

mysql> show global  variables like 'binlog_expire_logs_seconds';
+----------------------------+---------+
| Variable_name              | Value   |
+----------------------------+---------+
| binlog_expire_logs_seconds | 2592000 |
+----------------------------+---------+
1 row in set (0.01 sec)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Yuriev, 2021-06-12
@Rollex

If the global variable needs to be changed without restarting and before restarting the server , then (which is what you are doing) If the global variable should take a value different from the default when the server starts , then we crawl into the mysql configs (locations differ from the version of mysql/percona/mariadb and distribution) but in general, grep through the directory with mysql configs (make sure that the directory exists, sometimes just all the configs in /etc/my.cnf), I know that someone (the same package maintainer) has registered a value different from the default PS: here in general it’s not clear how the UPD was dragged in, I read it inattentively
SET GLOBAL variable = value;
grep 432000 -r /etc/mysql/

you want to set 432000, and after the restart it is reset to the default 2592000, for some reason I took the information exactly the opposite,
It's simple - you need to write the value in the mysql configs

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question