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 losing connection all the time

Discussion in 'General Discussion' started by nicklas, Jan 26, 2010.

  1. nicklas

    nicklas Well-Known Member

    Joined:
    Dec 22, 2005
    Messages:
    117
    Likes Received:
    0
    Trophy Points:
    16
    cPanel Access Level:
    Root Administrator
    Hi,

    For some weird reason mysql seems to lose the connection all the time.

    I have checked so many things but still not able to find it.

    i have checked if the sock is there, I run /scripts/mysqlup --force and changed root passowrd for mysql, even a run /scripts/upcp --force doesn't help.

    Any one else any suggestions?

    Thanks

    Errors:

    /usr/bin/mysqladmin: connect to server at 'localhost' failed
    error: 'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)'
    Check that mysqld is running and that the socket: '/var/lib/mysql/mysql.sock' exists!
    Grabbing mysql dbs........DBI connect('mysql:localhost','root',...) failed: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) at /usr/local/cpanel/Cpanel/Mysql.pm line 37

    ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
    horde.turba_objects horde.turba_objects: mysqldump: Got error: 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) when trying to connect
    /usr/bin/mysqlcheck: Got error: 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) when trying to connect

    /usr/bin/mysqlcheck: Got error: 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) when trying to connect
    horde.mnemo_memos horde.mnemo_memos: mysqldump: Got error: 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) when trying to connect
     
  2. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,448
    Likes Received:
    194
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    Try a reboot of the server. Not sure how helpful that is, but give it a go.
     
  3. nicklas

    nicklas Well-Known Member

    Joined:
    Dec 22, 2005
    Messages:
    117
    Likes Received:
    0
    Trophy Points:
    16
    cPanel Access Level:
    Root Administrator
    Hi, thanks for your suggestion, but the reboot didn't help either.

    I have moved some accounts away to another server and I discovered when I deleted those accounts their mysql DBs were not deleted on the server, is this indicating maybe something wrong with persmissions or other rights issues on mysql?
     
  4. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,448
    Likes Received:
    194
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
  5. anushkumar

    anushkumar Well-Known Member

    Joined:
    May 14, 2005
    Messages:
    51
    Likes Received:
    0
    Trophy Points:
    6
    Check if your /var or /tmp are full.

    Clear space if its the case.
     
  6. nicklas

    nicklas Well-Known Member

    Joined:
    Dec 22, 2005
    Messages:
    117
    Likes Received:
    0
    Trophy Points:
    16
    cPanel Access Level:
    Root Administrator
    ok found it, over the last days our /var was growing very fast and is now over 95% it seems that we have now a huge innodb file (ibdata1) we have to swap to innodb file per table, to avoid this huge growth and to avoid getting the 100% :-(

    Some websites have innodb tables (typo3 for example)

    I want to thank everyone for their help, i need to browse now to find what good settings are for InnoDB file per table in the /etc/my.cnf.

    Thank you
     
  7. nicklas

    nicklas Well-Known Member

    Joined:
    Dec 22, 2005
    Messages:
    117
    Likes Received:
    0
    Trophy Points:
    16
    cPanel Access Level:
    Root Administrator
    Is it possible that some one could paste the 'default' settings of the /etc/my.cnf with the settings for the innodb as recommend by cPanel, I understand that this is now included in a new server setup.

    Thanks.
     
  8. madaboutlinux

    madaboutlinux Well-Known Member

    Joined:
    Jan 24, 2005
    Messages:
    1,052
    Likes Received:
    2
    Trophy Points:
    38
    Location:
    Earth
    It is going to use the same amount of space. If the /var partition is too small, I would recommend you to move the /var/lib/mysql directory to /home (assuming that it's a largest partition on the server) and create a symlink.

     
  9. nicklas

    nicklas Well-Known Member

    Joined:
    Dec 22, 2005
    Messages:
    117
    Likes Received:
    0
    Trophy Points:
    16
    cPanel Access Level:
    Root Administrator
    Thanks, I have enabled the innodb per table option and reloaded all dbs, this 'shrinked' the 13GB ibdata1 file back to 1mb and per user it created the innodb tables, so the situations is pretty good under control regards the space usage, but I understand that cPanel has put some performance tweaks in new server installs, so if you have recently installed a new server and could paste this /etc.my.cnf file with the parts for the innodb tweak it would be great.

    Thanks
     
  10. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,448
    Likes Received:
    194
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    There actually several on the server by default, depending on your system specs you select one, rename and move to /etc/
    my-huge.cnf, my-large.cnf, my-medium.cnf, my-small.cnf
    Then edit depending on more testing using something like MySQLTuner for example.
    Linux Newbie Administrator Guide - 8.5 Running MySQL
     
  11. nicklas

    nicklas Well-Known Member

    Joined:
    Dec 22, 2005
    Messages:
    117
    Likes Received:
    0
    Trophy Points:
    16
    cPanel Access Level:
    Root Administrator
    Great, but as mentioned before i have no examples because i have not the oppertunity to deploy a new server. I am sorry but I can't do much with your comment :-(
     
  12. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,448
    Likes Received:
    194
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    Those files mentioned are your examples. They are on your server right now. If you open one or more of them and read whats inside them it might be helpful to you. As would be the link posted above which explains things a bit more. Or you can visit the MySQL site itself for all the juicy details:
    MySQL :: MySQL 5.1 Reference Manual :: 4.2.3.3 Using Option Files
    http://dev.mysql.com/doc/refman/5.1/en/option-files.html

    HTH
     
  13. nicklas

    nicklas Well-Known Member

    Joined:
    Dec 22, 2005
    Messages:
    117
    Likes Received:
    0
    Trophy Points:
    16
    cPanel Access Level:
    Root Administrator
    Hi, I have checked my server and the files are not there, honestly, that's why I asked if someone could paste the content of their file with the part of the innodb settings.
     
  14. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,448
    Likes Received:
    194
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    The files can be found on my server in these locations:

    /usr/share/mysql/
    /usr/share/doc/MySQL-server-5.0.89/

    I forgot to list one of them called:
    my-innodb-heavy-4G.cnf

    It's not a matter of simply pasting in someone elses config and go. You really need to understand a bit more about what you're doing here before doing it. IMHO.
     
  15. nicklas

    nicklas Well-Known Member

    Joined:
    Dec 22, 2005
    Messages:
    117
    Likes Received:
    0
    Trophy Points:
    16
    cPanel Access Level:
    Root Administrator
    Hi,

    Thanks very much, you are complete right but it is not my intention to do just a copy and paste, I want to understand and learn about it to avoid problems in future and also to control it better then it was till so far with only that one huge file. One of the problems i now suddenly fase is that a few accounts grow of out their space very fast, i bet it is related to this swap to use file per table option so basicly my 13GB file will now be given back in space to the users qouta? but as said it is all new so i need to do a lot of work to get it optimal.

    I will read up about this and my first priority is to see if there is an option to limit the dbs in size xx% of their usage space.

    Thanks again for your directions much appreciated. :)
     
Loading...

Share This Page