Mail stuck in the queue in the server with Plesk: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13)

Follow

Comments

5 comments

  • Avatar
    Jon Ireland

    I get the following error with this work around any ideas?

    Task "/usr/sbin/restorecon -v /var/lib/mysql/mysql.sock​" completed with error in 0 seconds, output:
    /usr/sbin/restorecon: lstat(/var/lib/mysql/mysql.sock​) failed: No such file or directory
    0
    Comment actions Permalink
  • Avatar
    Md Rasel Khan

    Number 5 step should I run one time right? No need to set cron job for this, right?

    0
    Comment actions Permalink
  • Avatar
    Mikhail Krivoshein

    The issue is still open. Just faced on AlmaLinux host.

    First of all, to verify if you suffer from this problem, run:

    ls -Zl /var/lib/mysql/*sock

    If you see anything other than the line below, you probably experience this issue exactly.

    srwxrwxrwx. 1 mysql mysql system_u:object_r:mysqld_var_run_t:s0 0 May 29 16:30 /var/lib/mysql/mysql.sock

    On systems that run systemd it is possible to configure a command to run after service has started. Modify /etc/systemd/system/mariadb.service.d/override.conf and add lines below:

    # Workaround so socket gets correct linux context
    [Service]
    ExecStartPost=chcon -t mysqld_var_run_t /var/lib/mysql/mysql.sock

    then do configuration reload and mariadb restart:

     systemctl daemon-reload
     systemctl restart mariadb

    Verify if it helped with ls command. If it did help, verify it still works after host reboot. 

    0
    Comment actions Permalink
  • Avatar
    maartenv

    There is no need to do a chcon as the default system policy is correct.

    Create a file /etc/systemd/system/mariadb.service.d/restorecon_socket.conf with the following contents:

    # Workaround so socket gets correct linux context

    [Service]
    ExecStartPost=/sbin/restorecon /var/lib/mysql/mysql.sock

    Next, run:
    # systemctl daemon-reload &&  systemctl restart mariadb

    Source: https://jira.mariadb.org/browse/MDEV-24941?focusedCommentId=233795&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-233795

    0
    Comment actions Permalink
  • Avatar
    Benjamin Weßel

    Hello,
    Thank you for the recommendations. We updated the article with another workaround accordingly.

    0
    Comment actions Permalink

Please sign in to leave a comment.

Have more questions? Submit a request