Wednesday, June 2, 2021

set wait_timeout in mariadb

 [root@database-rhel79 my.cnf.d]# mysql -u root

Welcome to the MariaDB monitor.  Commands end with ; or \g.

Your MariaDB connection id is 9

Server version: 10.4.18-MariaDB MariaDB Server


Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.


Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.



MariaDB [(none)]> set global wait_timeout=2592000;

Query OK, 0 rows affected (0.001 sec)


MariaDB [(none)]> set wait_timeout=2592000;

Query OK, 0 rows affected (0.001 sec)


Set max connections on mariadb

  1. Update the my.cnf file, so that the new value is used if the MySQL/MariaDB server is restarted.
  2. Use the SET GLOBAL command to update the value on the running MySQL/MariaDB server.

Fortunately, by using this method, you will not need to restart MySQL/MariaDB, and therefore will not need to experience any downtime.


In /etc/my.cnf

[mysqld]

max_connections=300

 



mysql -u root -p

Set the new max_connections value with the command:


SET GLOBAL max_connections=[desired new maximum number];

For example, to set max_connections to 200, the command is:


SET GLOBAL max_connections=200;