The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

MySQL Problems

Discussion in 'General Discussion' started by GloVine, Feb 8, 2005.

  1. GloVine

    GloVine Member

    Joined:
    Jul 5, 2004
    Messages:
    22
    Likes Received:
    0
    Trophy Points:
    1
    Hey,

    I am recieving an error for mysql, "To many Connections".

    I remember that there is a way to increase the number of connections allowed, but I cannot remember how to do it. Can someone help me thanks.

    I havent dealth with this error myself before so in lamen terms :P
     
  2. DigitalN

    DigitalN Well-Known Member

    Joined:
    Sep 23, 2004
    Messages:
    420
    Likes Received:
    1
    Trophy Points:
    18
    Hello,

    Edit or create the following file

    /etc/my.cnf

    Under the [mysqld] section add this

    [mysqld]

    max_connections=750 (the number) default is usually 500

    You could also add

    max_user_connections=50 (to limit per mysql user connections)

    Then restart mysql

    /etc/init.d/mysql stop
    /etc/init.d/mysql start

    You may have an issue that needs to be corrected but the above will do what you asked.
     
  3. GloVine

    GloVine Member

    Joined:
    Jul 5, 2004
    Messages:
    22
    Likes Received:
    0
    Trophy Points:
    1
    Thanks

    Thanks. All is fixed :)
     
  4. GloVine

    GloVine Member

    Joined:
    Jul 5, 2004
    Messages:
    22
    Likes Received:
    0
    Trophy Points:
    1
    More Problems

    Hey again,

    The above problem is fixed, but now I have another problem with mySQL and my server.

    Mysql Stats from CPU/Mysql usage via WHM.
    10.44 CPU
    1014.93 Memory

    At the moment, memory is sitting at 90.7% and in the red. Its usually around the 30-50% mark. With no great increase in the number of people using the server, infact an opposite as we just removed inactive accounts (free hosting), i dont think this has anything to do with to many accounts etc as we are only hosting roughly 300 accounts.

    Normally when this goes high, usually an account is responsible so a simple suspension of that account usually resolves it, but since its Mysql causing teh problem, not sure how I would go about minimising this.

    Help appreciated.
     
  5. GloVine

    GloVine Member

    Joined:
    Jul 5, 2004
    Messages:
    22
    Likes Received:
    0
    Trophy Points:
    1
    BUmp

    ~BUMP~

    Anyone?
     
  6. jester.ro

    jester.ro Well-Known Member
    PartnerNOC

    Joined:
    Feb 6, 2004
    Messages:
    304
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Bucharest, Romania
    cPanel Access Level:
    DataCenter Provider
    afaik default number of mysql_connections in my.cnf is 100

    so increasing it to 750 is huge. of course you get high loads.

    you should try playing with optimizing my.cnf, so that it caches connections.

    search these forums here. or search you server lof my-large.cnf, and look at it, and copy it over my.cnf (back it up first).


    also, you need to make some changes to your php.ini, and play with the number of total/persistent connections.

    i, for example, keep 100 persistent in php.ini, with 350 total in php.ini, and 370 in my.cnf


    use a program called mytop, or look in WHM for the mysql connections, and see wich user is abusing your server.

    you can limit per user number of connections.

    in ssh, type

    mysql -u root -p

    then

    use mysql;

    then

    update user set max_connections=XX where User='problem_user';

    (problem_user is the mysql username, not the cpanel username)

    after that command exit mysql and reload it.

    you can revert the above by setting max_connections=0 for the same user - 0 means unlimited.
     
Loading...

Share This Page