Facebook Twitter Instagram
    TecAdmin
    • Home
    • Ubuntu 20.04
      • Upgrade Ubuntu
      • Install Java
      • Install Node.js
      • Install Docker
      • Install LAMP Stack
    • Tutorials
      • AWS
      • Shell Scripting
      • Docker
      • Git
      • MongoDB
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    Home»General Articles»How to Check and Update max_connections value in MySQL

    How to Check and Update max_connections value in MySQL

    RahulBy RahulApril 10, 20162 Mins Read

    Some times your server may experience issue of too many connections in MySQL server. To fix this you can increase the max_connections value in your mysql configuration.

    Check max_connections Value

    Max connections value are stored with variable named max_connections. Login to you mysql terminal with privileged user and execute following query.

    mysql> SHOW VARIABLES LIKE "max_connections";
    
    +-----------------+-------+
    | Variable_name   | Value |
    +-----------------+-------+
    | max_connections | 150   |
    +-----------------+-------+
    1 row in set (0.00 sec)
    

    As per above output max_connections value is set to 150.

    Update max_connections Value

    Before increasing this value, make sure your server have enough resources to handle more queries. Now execute below query in mysql terminal to set this value temporarily. Remember that this value will reset on next mysql reboot.

    mysql> SET GLOBAL max_connections = 250;
    

    To set this value permanently, edit mysql configuration file on your server and set following variable. The configuration file location may change as per your operating system. By default you can find this at /etc/my.cnf on CentOS and RHEL based system and /etc/mysql/my.cnf on Debian based system.

      max_connections = 250
    

    Now restart mysql service and check value again with above given command. This time you will see that value is set to 250.

    max_connections MySQL
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp
    Previous ArticleHow to Install Wine 5.0 on Ubuntu 18.04 & 16.04 LTS
    Next Article How to Install Wine 5.6 on CentOS, RHEL and Fedora

    Related Posts

    Filesystem Hierarchy Structure (FHS) in Linux

    Updated:July 1, 20222 Mins Read

    What is CPU? – Definition, Types and Parts

    3 Mins Read

    How to Install Ionic Framework on Ubuntu 22.04

    3 Mins Read

    What is the /etc/hosts file in Linux

    Updated:June 27, 20222 Mins Read

    Creating DMARC Record for Your Domain

    Updated:June 29, 20223 Mins Read

    What is Computer Hardware?

    4 Mins Read

    2 Comments

    1. Jayachandran on January 21, 2019 11:06 am

      Hey Rahul, does the max_connections value depend on the resource available if yes then how do we calculate and arrive at a value to be fixed instead of 250. Is there a formula for calculating the same.

      Reply
    2. giulio on November 30, 2017 10:04 am

      Gratias Rahul! Good Job. Au revoir

      Reply

    Leave A Reply Cancel Reply

    Recent Posts
    • Filesystem Hierarchy Structure (FHS) in Linux
    • How to accept user input in Python
    • What is difference between var, let and const in JavaScript?
    • What is CPU? – Definition, Types and Parts
    • What is the /etc/aliases file
    Facebook Twitter Instagram Pinterest
    © 2022 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.