Announcement

Collapse
No announcement yet.

MySQL socks failure after running "yum update"

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • MySQL socks failure after running "yum update"

    Ok I am running a CloudLinux/cPanel VM running only 2 accounts. Everything was fine until yesterday when I was getting errors like this on the accounts/ websites:

    Fatal error: Out of memory (allocated 838860) (tried to allocate 12288 bytes) in ......../public_html/wp-includes/post.php on line 3062

    So I worked for a couple hours on seeing if I could increase resources, etc and all seemed to not do anything. I then ran "yum update" and then rebooted but I was then getting errors like this:

    Code:
    Could not connect: Cant connect to local MySQL server through socket /var/lib/mysql/mysql.sock (2)
    Then I had my VM provider (VPS.net) go in and check the reason and solution and heres what he said when he fixed it:

    I have done many things.
    Some tables were crashed. I have repaired them.
    You have wrong permissions for both sites in public_html folders. I have fixed it.
    I have changed passwords for MySQL users.
    And I have changed wordpress file /wp-config.php:
    /** MySQL hostname */^M
    define(DB_HOST, localhost);

    TO:
    /** MySQL hostname */^M
    define(DB_HOST, 127.0.0.1);

    I think, it was the root of issue.
    Because, after this change, site has started working.

    So my questions are:
    1) Why did the update cause permissions to fail/change?
    2)Why did the update cause DB_HOST to be renamed?

    Is there anything else I should do to troubleshoot?

  • #2
    Well, I believe issue is still there. You just connect to mysql through a network now, instead of socket. MySQL clients like php or console automatically use socket when localhost is defined as DB host to connect. And definitely issue is not in permissions for user files, we never change them.

    As of now please check if you are able to connect o mysql from cagefs inside, like:

    Code:
    su -l username -s /bin/bash
    
    mysql user_DBNAME -h localhost -u user_USERNAME -p
    But also check if you see socket from cagefs inside:

    Code:
    su -l username -s /bin/bash
    
    ls -la /var/lib/mysql/mysql.sock
    The /var/lib/mysql/ should be mounted with /etc/cagefs/cagefs.mp file . And, I have no ideas how it could be broken with update/reboot.

    Comment


    • #3
      You
      e right, since it was "fixed" a few horus ago, the VM is very slow though I see no more error messages.

      I just tried to connect to mysql from inside cagefs and get this error:

      Code:
      ERROR 2002 (HY000): Can	 connect to local MySQL server through socket /var/lib/mysql/mysql.sock (2)
      And when I check the second item I get this error:

      Code:
      MYUSERNAME@myservername [~]# ls -la /var/lib/mysql/mysql.sock
      
      /bin/ls: cannot access /var/lib/mysql/mysql.sock: No such file or directory
      Is this good info? What can I do to troubleshoot more?

      Comment


      • #4
        I just re-ran

        Code:
        yum install cagefs
        
        /usr/sbin/cagefsctl --init
        
        /usr/sbin/cagefsctl --enable-all
        and the tried to check mysql.sock again from the above commands but got the same error

        Comment


        • #5
          I believe /var/lib/mysql is not added to cagefs.mp file. Here is an entry from test server:

          Code:
          # grep mysql /etc/cagefs/cagefs.mp
          
          /var/lib/mysql
          
          #
          If it is not there please add this line then run cagefsctl --remount-all

          Comment


          • #6
            Thank you~ When I run that I get this:

            Code:
            root@serv [~]# grep mysql /etc/cagefs/cagefs.mp
            
            root@serv [~]# /var/lib/mysql
            
            -bash: /var/lib/mysql: is a directory
            Is that correct?

            I then ran cagefsctl --remount-all but it just shows this:

            Code:
            root@serv [~]# cagefsctl --remount-all
            
            root@serv [~]#
            Is that all correct?

            Comment


            • #7
              What is the output of:

              ls -l /var/lib/mysql

              and

              grep socket /etc/my.cnf

              Comment


              • #8
                Many thanks~

                Here is the redacted output for:

                Code:
                ls -l /var/lib/mysql
                it shows:

                Code:
                root@serv [~]# ls -l /var/lib/mysql
                
                total 110380
                
                drwxr-xr-x 13 mysql mysql     4096 May  1 01:47 ./
                
                drwxr-xr-x 25 root  root      4096 May  1 03:26 ../
                
                -rwxr-xr-x  1 mysql mysql 25632488 Apr 29 21:42 hostname.serv.com.err*
                
                -rw-rw----  1 mysql mysql        8 Apr 29 21:42 hostname.serv.com.pid
                
                drwxr-xr-x  2 mysql mysql    12288 Feb 16 17:50 dbname1/
                
                drwxr-xr-x  2 mysql mysql     4096 Apr 29 15:05 dbname2/
                
                drwxr-xr-x  2 mysql mysql     4096 Feb 16 16:20 cphulkd/
                
                drwxr-xr-x  2 mysql mysql     4096 May  1 05:30 eximstats/
                
                -rwxr-xr-x  1 mysql mysql 18874368 May  1 07:01 ibdata1*
                
                -rwxr-xr-x  1 mysql mysql  5242880 May  1 07:01 ib_logfile0*
                
                -rwxr-xr-x  1 mysql mysql  5242880 May  1 07:06 ib_logfile1*
                
                drwxr-xr-x  2 mysql mysql     4096 Feb 16 16:20 leechprotect/
                
                drwxr-xr-x  2 mysql mysql     4096 Feb 16 16:20 modsec/
                
                drwxr-xr-x  2 mysql mysql     4096 Apr 28 02:02 mysql/
                
                srwxrwxrwx  1 mysql mysql        0 Apr 29 21:42 mysql.sock=
                
                -rwxr-xr-x  1 mysql mysql        6 Apr 28 02:02 mysql_upgrade_info*
                
                drwxr-xr-x  2 mysql mysql     4096 Apr 28 02:02 performance_schema/
                
                drwxr-xr-x  2 mysql mysql     4096 Apr 28 02:14 roundcube/
                
                -rwxr-xr-x  1 mysql mysql     1848 Apr 28 02:02 RPM_UPGRADE_HISTORY*
                
                -rwxr-xr-x  1 mysql mysql     1348 Apr 28 02:02 RPM_UPGRADE_MARKER-LAST*
                
                drwxr-xr-x  2 mysql mysql     4096 Feb 16 16:20 whmxfer/
                
                -rwxr-xr-x  1 root  root  57814016 Apr 29 14:55 wp_posts.MYI*
                
                drwxr-xr-x  2 mysql mysql     4096 Apr 30 21:17 dbname3/
                and for this:

                Code:
                grep socket /etc/my.cnf
                I get this:

                Code:
                root@serv [~]# grep socket /etc/my.cnf
                
                socket=/var/lib/mysql/mysql.sock

                Comment


                • #9
                  You are really missing /var/lib/mysql in /etc/cagefs/cagefs.mp file. That is why socked is not available. Please add it there and do cagefsctl --remount-all .

                  If you are not sure how to do it or issue is still there just create support ticket at https://helpdesk.cloudlinux.com and we will fix it fast.

                  Comment

                  Working...
                  X