システム変数永続化

 

(8.0.33)
https://gihyo.jp/dev/serial/01/mysql-road-construction-news/0094
https://dev.mysql.com/doc/refman/8.0/ja/option-files.html

「mysqld-auto.cnf」が「my.cnf」よりも優先


(1) my.cnf

Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf /usr/etc/my.cnf ~/.my.cnf

cat /etc/my.cnf


(2) mysqld-auto.cnf

select @@max_connections;
cat /var/lib/mysql/mysqld-auto.cnf


SET PERSIST max_connections=400;

select @@max_connections;
cat /var/lib/mysql/mysqld-auto.cnf

systemctl restart mysqld

select @@max_connections;
cat /var/lib/mysql/mysqld-auto.cnf

 

SET PERSIST_ONLY max_connections=200;

select @@max_connections;
cat /var/lib/mysql/mysqld-auto.cnf

systemctl restart mysqld

select @@max_connections;
cat /var/lib/mysql/mysqld-auto.cnf

 

RESET PERSIST max_connections;

select @@max_connections;
cat /var/lib/mysql/mysqld-auto.cnf

systemctl restart mysqld

select @@max_connections;
cat /var/lib/mysql/mysqld-auto.cnf

(19c)

「spfileorcl.ora」が「initorcl.ora」よりも優先

※ サーバー・パラメータ・ファイルが存在する場合、初期化パラメータ・ファイルは使用されない


(1) 初期化パラメータ・ファイル initorcl.ora

cd $ORACLE_HOME/dbs

cat initorcl.ora


(2) サーバー・パラメータ・ファイル spfileorcl.ora

 

show parameter processes

alter system set processes = 400 scope=spfile sid='*';

show parameter processes

shutdown immediate
startup

show parameter processes


alter system reset processes scope=spfile sid='*';

show parameter processes

shutdown immediate
startup

show parameter processes

 

(15)
https://www.postgresql.jp/document/15/html/sql-altersystem.html


postgresql.auto.conf」が「postgresql.conf」よりも優先


(1) postgresql.conf

cd $PGDATA

cat postgresql.conf | grep max_connections

(2) postgresql.auto.conf

cd $PGDATA

show max_connections;
cat postgresql.auto.conf

ALTER SYSTEM SET max_connections = 400;

show max_connections;
cat postgresql.auto.conf

sudo systemctl restart postgresql-15

show max_connections;
cat postgresql.auto.conf

 

ALTER SYSTEM RESET max_connections;

show max_connections;
cat postgresql.auto.conf

sudo systemctl restart postgresql-15

show max_connections;
cat postgresql.auto.conf

 

 

(2022)


調べた限りパラメータ・ファイルなし