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 '19 at 21:32

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.


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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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