Increasing mysql or mariadb max connections

  1. Find out whether MySQL, or MariaDB service is used:

    systemctl list-unit-files | grep -E ‘mysql|mariadb’
    mariadb.service enabled

  2. Create an override for the service file from the previous step:

    systemctl edit mariadb.service

    Note: In case mysql.service, or mysqld.service was displayed on the previous step, replace “mariadb.service” with it.

  3. Add the following content to the opened text editor and save the file:

    [Service]
    LimitNOFILE=4096

    Note: Value might be increased if required, 4096 is only a suggested value.

  4. Restart the MySQL/MariaDB server:

    systemctl restart mysql mysqld mariadb 2>/dev/null