Every time I reboot Mariadb places me the max_connections in 151 and in the my.cnf I have it with 300. Why does this happen?

  • 1
    Then wrong config file or not in [mysqld] section. 151 is usually plenty; why do you think you need more? Is this a web site? Driven by Apache? nginx? Tomcat?
    – Rick James
    Jun 29, 2019 at 21:32

2 Answers 2


This depend if you set max_connections under the correct section inside my.cnf. what do you need to check(with examples)

  1. go to MySQL Directory cd /opt/mysql
  2. edit my.cnf using any text editor sudo vi my.cnf
  3. search for [mysqld]
  4. add the following lines directly under it max_connections=300
  5. save and quit
  6. restart the services.

Don't want a downtime?

  1. connect to MySQL using root user mysql -u root -p
  2. SET GLOBAL max_connections=300;
  3. quit
  • I will check if it is below that directive Jul 1, 2019 at 2:18
  • Just to be clear, the default location for my.cnf is /etc/mysql/my.cnf typically
    – jhaagsma
    Jun 18, 2021 at 18:58
  • 1
    For mariadb it's /etc/mysql/mariadb.cnf.d/50-servers.cnf
    – Elikill58
    May 16, 2023 at 12:52

What OS are you on?

If you are on Windows you can do this:

C:\Program Files\MySQL\MySQL Server 8.0\bin>mysqld --verbose --help | findstr /i ini

Part of the output on my system is:

C:\WINDOWS\my.ini C:\WINDOWS\my.cnf C:\my.ini C:\my.cnf C:\Program Files\MySQL\MySQL Server 8.0\my.ini C:\Program Files\MySQL\MySQL Server 8.0\my.cnf

Which are ALL the possible location this setting can be at 151, and not at 300.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.