Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 15 of 15
  1. #1
    Member
    Join Date
    Dec 2005
    Posts
    117

    Red face Mysql losing connection all the time

    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. #2
    cPanel Product Evangelist Infopro's Avatar
    Join Date
    May 2003
    Location
    Pennsylvania
    Posts
    7,894
    cPanel/Enkompass Access Level

    Root Administrator

    Lightbulb

    ...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?
    Try a reboot of the server. Not sure how helpful that is, but give it a go.

  3. #3
    Member
    Join Date
    Dec 2005
    Posts
    117

    Default

    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. #4
    cPanel Product Evangelist Infopro's Avatar
    Join Date
    May 2003
    Location
    Pennsylvania
    Posts
    7,894
    cPanel/Enkompass Access Level

    Root Administrator

    Lightbulb

    Poking around the forums have turned up several threads on this topic, here's a few to get you going.
    http://forums.cpanel.net/f5/fix-cant...2-a-26166.html
    http://forums.cpanel.net/f5/cant-con...1-a-78444.html

  5. #5
    Member anushkumar's Avatar
    Join Date
    May 2005
    Posts
    51

    Default

    Check if your /var or /tmp are full.

    Clear space if its the case.

  6. #6
    Member
    Join Date
    Dec 2005
    Posts
    117

    Default

    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. #7
    Member
    Join Date
    Dec 2005
    Posts
    117

    Default

    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. #8
    Member
    Join Date
    Jan 2005
    Location
    Earth
    Posts
    1,050

    Default

    Quote Originally Posted by nicklas View Post
    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.
    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.

    service mysql stop
    mv /var/lib/mysql /home/
    ln -s /home/mysql /var/lib/mysql
    service mysql start

  9. #9
    Member
    Join Date
    Dec 2005
    Posts
    117

    Default

    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. #10
    cPanel Product Evangelist Infopro's Avatar
    Join Date
    May 2003
    Location
    Pennsylvania
    Posts
    7,894
    cPanel/Enkompass Access Level

    Root Administrator

    Lightbulb

    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. #11
    Member
    Join Date
    Dec 2005
    Posts
    117

    Default

    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. #12
    cPanel Product Evangelist Infopro's Avatar
    Join Date
    May 2003
    Location
    Pennsylvania
    Posts
    7,894
    cPanel/Enkompass Access Level

    Root Administrator

    Lightbulb

    Quote Originally Posted by nicklas View Post
    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 :-(
    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/...ion-files.html

    HTH

  13. #13
    Member
    Join Date
    Dec 2005
    Posts
    117

    Default

    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. #14
    cPanel Product Evangelist Infopro's Avatar
    Join Date
    May 2003
    Location
    Pennsylvania
    Posts
    7,894
    cPanel/Enkompass Access Level

    Root Administrator

    Lightbulb

    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. #15
    Member
    Join Date
    Dec 2005
    Posts
    117

    Smile

    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.

Similar Threads & Tags
Similar threads

  1. How to view all sites bandwidth/connection usage at once in real time?
    By ambition13 in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 11-05-2010, 08:41 PM
  2. Copy multiple accounts = Recovered after losing connection.
    By jmginer in forum cPanel and WHM Discussions
    Replies: 3
    Last Post: 02-24-2009, 12:40 PM
  3. mysql connection
    By shadowincarnate in forum Database Discussions
    Replies: 3
    Last Post: 02-22-2008, 03:40 PM
  4. Cpanel connection time out.
    By trenominal in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 12-31-2006, 12:08 PM
  5. Losing connection to database server (on second machine)
    By mickmel in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 01-05-2006, 05:32 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube