Results 1 to 17 of 17

Thread: MariaDB & systemctl issue: /tmp/mysql.sock is within the PrivateTmp

  1. #1

    MariaDB & systemctl issue: /tmp/mysql.sock is within the PrivateTmp

    This is more of an FYI until we sort out a solution.

    By default, we have MySQL setup the mysql.sock in:
    Code:
    /tmp/mysql.sock
    The problem is that the fancy systemctl feature:
    Code:
    PrivateTmp=true
    will create a hidden jail for the given process, so it's version of /tmp may differ from other services.

    The current easy workaround is to edit:
    Code:
    /etc/systemd/system/mysqld.service
    /etc/systemd/system/httpd.service
    /etc/systemd/system/php-fpm*.service
    /etc/systemd/system/directadmin.service
    etc..
    and anything else that needs access to MySQL/MariaDB, and set:
    Code:
    PrivateTmp=false
    Then reload the systectl daemon and restart all services
    Code:
    systemctl daemon-reload
    This is not my preference, but would at least all you to get past the issue for now.

    A related error might look like
    Code:
    Error: 2002 - No such file or directory
    The fix we'll most likely use will be to move the .sock file to:
    Code:
    /usr/local/mysql/data/mysql.sock
    which would be /home/mysql/mysql.sock with the default symlinks.

    John

  2. #2
    Update:

    I've now changed the DA binaries, compiled date April 29th and later to point to:
    /usr/local/mysql/data/mysql.sock

    CB2 will now use the above mysql.sock path for php compiles on any Debian 8 system with systemd.
    That being said, you must use CustomBuild 2.0 with Debian 8, and Debian 8 must be using systemd.

    The /etc/systemd/system/mysqld.service now has this line:
    Code:
    ExecStart=/usr/local/mysql/bin/mysqld_safe --datadir=/usr/local/mysql/data --pid-file=/usr/local/mysql/data/mysqld.pid --socket=/usr/local/mysql/data/mysql.sock
    The --user=mysql part was removed, as it was redundant to the User=mysql setting.

    John

  3. #3
    Join Date
    Feb 2013
    Posts
    12
    great job

  4. #4
    Join Date
    Apr 2005
    Location
    Netherlands
    Posts
    32
    Some problems with install of MariaDB:

    1. There's no password configured for the root user.
    2. Because of the non-default location of mysql.sock the mysql and mysqladmin commands aren't working. They need the parameter --socket /usr/local/mysql/data/mysql.sock

    I suggest adding the following to /etc/my.cnf by default:
    Code:
    [client]
    socket=/usr/local/mysql/data/mysql.sock

  5. #5
    Thanks, setup.sh updated to add the socket= to the [clients] section.

    John

  6. #6
    Join Date
    Apr 2005
    Location
    Netherlands
    Posts
    32
    Great! Thank you. And the password for the MySQL root user(s)? root@localhost, root@::1, root@127.0.0.1 and root@host.name
    These accounts had an empty password after installation.

  7. #7
    ::1 and 127.0.0.1 are not set for other systems either. We rely on "localhost".
    Also make sure ::1 is not set to "localhost" in the /etc/hosts file, as that confuses some services by default.. eg: dovecot isn't bound to ipv6 by default (although CB2 checks for ipv6=1 in the directadmin.conf, and does enable it for dovecot, if DA has it turned on)
    John

  8. #8
    Join Date
    Sep 2009
    Location
    NZ
    Posts
    66
    I tried the suggestions in this thread but i am still getting the following error:-

    Code:
    ./build mariadb
    ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/usr/local/mysql/data/mysql.sock' (2)
    mv: 'mariadb-5.5.43-linux-x86_64.tar.gz' and '/usr/local/mariadb-5.5.43-linux-x86_64.tar.gz' are the same file
    Stopping mysqld ...
    -e Stopping mysqld:             [ FAILED ]
    Synchronizing state for mysqld.service with sysvinit using update-rc.d...
    Executing /usr/sbin/update-rc.d mysqld defaults
    Executing /usr/sbin/update-rc.d mysqld enable
    -e Starting mysqld:             [ OK ]
    Giving mysqld a few seconds to start up...
    Version check failed. Got the following error when calling the 'mysql' command line client
    ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/usr/local/mysql/data/mysql.sock' (2)
    FATAL ERROR: Upgrade failed
    Restarting MySQL.

  9. #9
    Join Date
    Feb 2016
    Posts
    4

    Please help!

    No matter what I do I get the following error when trying to login to MariaDB.

    ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
    ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
    ERROR 1045 (28000): Access denied for user 'da_admin'@'localhost' (using password: YES)

  10. #10
    Join Date
    Feb 2008
    Posts
    131
    Quote Originally Posted by DirectAdmin Support View Post
    Update:

    I've now changed the DA binaries, compiled date April 29th and later to point to:
    /usr/local/mysql/data/mysql.sock

    CB2 will now use the above mysql.sock path for php compiles on any Debian 8 system with systemd.
    That being said, you must use CustomBuild 2.0 with Debian 8, and Debian 8 must be using systemd.

    The /etc/systemd/system/mysqld.service now has this line:
    Code:
    ExecStart=/usr/local/mysql/bin/mysqld_safe --datadir=/usr/local/mysql/data --pid-file=/usr/local/mysql/data/mysqld.pid --socket=/usr/local/mysql/data/mysql.sock
    The --user=mysql part was removed, as it was redundant to the User=mysql setting.

    John

    i dont know but i have a default 8.3 debian, default install but i still need to put the PrivateTmp=false , otehrwise it would not start

    this is line i have in the file

    ExecStart=/usr/local/mysql/bin/mysqld_safe --datadir=/usr/local/mysql/data --pid-file=/usr/local/mysql/data/mysqld.pid --socket=/usr/local/mysql/data/mysql.sock

    o and the default root pass was empty..;/

  11. #11
    Join Date
    Feb 2008
    Posts
    131
    could this be becuase i have an mounted tmpfile as tmp with these options?
    /var/tmpMnt /tmp ext2 loop,noexec,nosuid,nodev,rw 0 0

    i had to put the PrivateTmp=false to these services:

    system/dovecot.service
    system/httpd.service
    system/exim.service
    system/mysqld.service
    system/clamd.service

  12. #12
    Join Date
    Feb 2008
    Posts
    131
    and now i find out the the admin user is missing?
    i really start to regret to even try debian.. its the second time last year i had the same experience.
    endless hours of troubleshooting did anyone ever finished the debian install flawless?

    really?

    root@xxxx:/usr/local/directadmin/data/users# ls -lah
    total 8.0K
    drwx--x--x 2 diradmin diradmin 4.0K Feb 10 13:04 .
    drwx--x--x 8 diradmin diradmin 4.0K Feb 10 16:15 ..

    sigh so need to start from scratch again as i cannot trust the install..
    so whatabout the debian install can i take this seriously?
    Last edited by soulshepard; 02-10-2016 at 07:54 AM.

  13. #13
    Join Date
    Feb 2008
    Posts
    131
    i switched back to debian7 as its still in beta. would be hading to see this also in the https://www.directadmin.com/clients/ when you activate a license.

  14. #14
    Join Date
    Aug 2006
    Location
    LT, EU
    Posts
    7,526
    This must have been the cause. Feel free to open a ticket in tickets.directadmin.com for a free installation on debian8.
    Martynas Bendorius
    MB Martynas IT. Professional server management company. Official DirectAdmin, CloudLinux, LiteSpeed and Comodo partners.

  15. #15
    Join Date
    Feb 2012
    Posts
    41
    Quote Originally Posted by DirectAdmin Support View Post
    Update:

    I've now changed the DA binaries, compiled date April 29th and later to point to:
    /usr/local/mysql/data/mysql.sock

    CB2 will now use the above mysql.sock path for php compiles on any Debian 8 system with systemd.
    That being said, you must use CustomBuild 2.0 with Debian 8, and Debian 8 must be using systemd.

    The /etc/systemd/system/mysqld.service now has this line:
    Code:
    ExecStart=/usr/local/mysql/bin/mysqld_safe --datadir=/usr/local/mysql/data --pid-file=/usr/local/mysql/data/mysqld.pid --socket=/usr/local/mysql/data/mysql.sock
    The --user=mysql part was removed, as it was redundant to the User=mysql setting.

    John
    I upgraded to Debian 8, but I've to do a symlink on every mysql restart:

    ln -s /tmp/mysql.sock /usr/local/mysql/data/mysql.sock

    Otherwise php can't connect to mysql...

  16. #16
    Join Date
    Sep 2013
    Posts
    5
    Quote Originally Posted by Derevko View Post
    I upgraded to Debian 8, but I've to do a symlink on every mysql restart:

    ln -s /tmp/mysql.sock /usr/local/mysql/data/mysql.sock

    Otherwise php can't connect to mysql...
    Similar problem, but now i need to do
    ln -s /home/mysql/mysql.sock /tmp/mysql.sock

    Because "admin backups util" tries to use /tmp/mysql.sock (looks like this value is hardcoded into dataskg)

  17. #17
    Join Date
    Sep 2013
    Posts
    5
    Quote Originally Posted by alexbyk View Post
    Similar problem, but now i need to do
    ln -s /home/mysql/mysql.sock /tmp/mysql.sock

    Because "admin backups util" tries to use /tmp/mysql.sock (looks like this value is hardcoded into dataskg)
    Fixed by adding
    Code:
    [client]
    socket=/usr/local/mysql/data/mysql.sock
    to the /etc/my.cnf file

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •