Page 2 of 2 FirstFirst 12
Results 21 to 29 of 29

Thread: Error connecting to MySQL: Can't connect to local MySQL server through socket

  1. #21
    Join Date
    Jun 2013
    Posts
    38
    I used server:~# service mysqld restart

    And a sites are upp and running again.

    running mysql give me this.
    server:~# mysql
    ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

    Shall I do a rebuild php anyway? the problem with empty databases is still there

  2. #22
    Join Date
    Jun 2013
    Posts
    38
    Sorry no change after ./build php

    It's the same issue.

    Best regards
    Jukka

  3. #23
    Join Date
    Jun 2013
    Posts
    38
    It looks like i have this '/tmp/mysql.sock' somewhere instead of the one i put into /etc/my.cnf

  4. #24
    Join Date
    Apr 2005
    Location
    GMT +7.00
    Posts
    11,882
    Did you restart directadmin after modifying /usr/local/directadmin/conf/mysql.conf?

  5. #25
    Join Date
    Jun 2013
    Posts
    38
    I used the restart button in Directadmin service monitor,

    I hope that would restart Directadmin. I did it again but still get this when trying to backup databases.

    Error while backing up database aeroglobal_xxxx
    Error while backing up database aeroglobal_xxxx: The sql file is 0 bytes in size: /home/admin/admin_backups/aeroglobal/backup/aeroglobal_xxxx.sql
    mysqldump error output: mysqldump: Got error: 2002: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) when trying to connect

  6. #26
    Join Date
    Jun 2013
    Posts
    38
    But if i do this i get some errors.

    server:~# service directadmin restart
    Job for directadmin.service failed. See 'systemctl status directadmin.service' and 'journalctl -xn' for details.

    server:~# systemctl status directadmin.service
    directadmin.service - SYSV: Allows users to modify their websites. They modify thier: email, subdomains, databases, dns record, etc...
    Loaded: loaded (/etc/init.d/directadmin)
    Active: failed (Result: resources) since Thu 2016-03-31 21:18:07 CEST; 3min 55s ago
    Process: 13705 ExecStop=/etc/init.d/directadmin stop (code=exited, status=0/SUCCESS)
    Process: 8352 ExecStart=/etc/init.d/directadmin start (code=exited, status=0/SUCCESS)
    Main PID: 739 (code=exited, status=0/SUCCESS)

    Mar 31 21:18:07 server.thndata.com directadmin[8352]: Starting DirectAdmin: [ OK ]
    Mar 31 21:18:07 server.thndata.com systemd[1]: PID file /var/run/directadmin.pid not readable (yet?) after start.
    Mar 31 21:18:07 server.thndata.com systemd[1]: directadmin.service never wrote its PID file. Failing.
    Mar 31 21:18:07 server.thndata.com systemd[1]: Failed to start SYSV: Allows users to modify their websites. They modify thier: email, subdomains, databases...d, etc....
    Mar 31 21:18:07 server.thndata.com systemd[1]: Unit directadmin.service entered failed state.
    Hint: Some lines were ellipsized, use -l to show in full.


    And.

    server:~# journalctl -xn
    -- Logs begin at Wed 2016-03-30 21:42:44 CEST, end at Thu 2016-03-31 21:23:01 CEST. --
    Mar 31 21:20:31 server.thndata.com clamd[614]: SelfCheck: Database status OK.
    Mar 31 21:21:01 server.thndata.com CRON[8438]: pam_unix(cron:session): session opened for user root by (uid=0)
    Mar 31 21:21:01 server.thndata.com CRON[8439]: (root) CMD (/usr/local/directadmin/dataskq)
    Mar 31 21:21:01 server.thndata.com CRON[8438]: pam_unix(cron:session): session closed for user root
    Mar 31 21:22:01 server.thndata.com CRON[8458]: pam_unix(cron:session): session opened for user root by (uid=0)
    Mar 31 21:22:01 server.thndata.com CRON[8459]: (root) CMD (/usr/local/directadmin/dataskq)
    Mar 31 21:22:01 server.thndata.com CRON[8458]: pam_unix(cron:session): session closed for user root
    Mar 31 21:23:01 server.thndata.com CRON[8478]: pam_unix(cron:session): session opened for user root by (uid=0)
    Mar 31 21:23:01 server.thndata.com CRON[8479]: (root) CMD (/usr/local/directadmin/dataskq)
    Mar 31 21:23:01 server.thndata.com CRON[8478]: pam_unix(cron:session): session closed for user root
    Last edited by THN Data; 03-31-2016 at 12:23 PM.

  7. #27
    Join Date
    Apr 2005
    Location
    GMT +7.00
    Posts
    11,882
    OK, here is a solution.

    Updated version of /etc/my.cnf:

    Code:
    [mysql]
    socket = /usr/local/mysql/data/mysql.sock
    
    [mysqld]
    socket = /usr/local/mysql/data/mysql.sock
    local-infile = 0
    
    [mysqldump]
    socket = /usr/local/mysql/data/mysql.sock
    p.s. if your /etc/my.cnf has more instructions then update it, do not overwrite. If you overwrite it, it might break MariaDB/MySQL.

  8. #28
    Join Date
    Jun 2013
    Posts
    38
    Thanks Alex.

    Super nice having you checking my server and helping me to sort things out. And great that you posted the solution here.

    Thanks again
    Jukka

  9. #29
    Join Date
    Aug 2014
    Posts
    75
    Thank you, my problem has been fixed by the guide, I just added this line to my.cnf and then restarted mysql.
    socket=/usr/local/mysql/data/mysql.sock

    service mysql restart
    Freelance Linux and Windows system admin
    LPIC-1 and LPiC-2 certified
    Telegram @sysnasri
    https://web.telegram.org/#/im?p=@sysnasri
    ========================
    5 Years of experience in Web Hosting.

Page 2 of 2 FirstFirst 12

Posting Permissions

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