Want to subscribe to topics you're interested in?
Become a Member

MariaDB ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (

Discussion in 'Install & Upgrades or Pre-Install Questions' started by serdarka, Jan 11, 2019.

  1. serdarka

    serdarka New Member

    6
    0
    1
    Jan 11, 2019
    Ratings:
    +0
    Local Time:
    4:02 PM
    Please fill in any relevant information that applies to you:
    • CentOS Version: i.e. CentOS 7 64bit
    • Centmin Mod Version Installed:123.09beta01
    • Nginx Version Installed: . 1.15.8
    • PHP Version Installed: 7.2.9
    • MariaDB MySQL Version Installed:10.2.xx
    • When was last time updated Centmin Mod code base ? :today
    • Persistent Config: I dont have
    Hi,
    I instralled the Centmin mod with guide.
    When I try mysql -u root -p
    I get this error after entering password
    ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2 "No such file or directory")

    When I try Phpmyadmin
    I get similar error mysqli_real_connect(): (HY000/2002): No such file or directory

    When I check with this code yum install MariaDB-server MariaDB-client
    I get this
    Package MariaDB-server-10.1.37-1.el7.centos.x86_64 already installed and latest version
    Package MariaDB-client-10.1.37-1.el7.centos.x86_64 already installed and latest version
    Nothing to do

    Can someone help me please
    Thank you
     
  2. eva2000

    eva2000 Administrator Staff Member

    38,678
    8,540
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +13,123
    Local Time:
    2:02 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    1. how did you install MariaDB 10.2.xx ? or you mean you have MariaDB 10.1.37 ?
    2. how did you install phpmyadmin ?
    MySQL root password is in install log in /root/centminlogs as well as populated in /root/.my.cnf
    • If you know your MySQL root password and it's same as /root/.my.cnf, you can use centmin.sh menu option 11, submenu option 0 to reset the MySQL root password as it will prompt you for existing mysql root password and new mysql root password.
    As /root/.my.cnf has configured your mysql root user password, you do not need to pass the -u root -p when running mysql command

    instead of
    Code (Text):
    mysql -u root -p
    

    just running mysql should work
    Code (Text):
    mysql
    
     
  3. serdarka

    serdarka New Member

    6
    0
    1
    Jan 11, 2019
    Ratings:
    +0
    Local Time:
    4:02 PM
    It installed everything when same time Centmin mode one liner installer.

    Phpmyadmin istalled via phpmyadmin.sh
    mysql itself giving me same error
    ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2 "No such file or directory")

    Yes MariaDB 10.1.37

    I have the root password for Mysql



    I don`t know what is wrong
     
  4. eva2000

    eva2000 Administrator Staff Member

    38,678
    8,540
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +13,123
    Local Time:
    2:02 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    is mysql running ?

    can check with either these commands
    Code (Text):
    service mysqld status
    systemctl status mysql
    systemctl status mariadb
    

    if not running restart or start
    Code (Text):
    mysqlrestart
    mysqlstart
    

    or
    Code (Text):
    systemctl restart mysql
    systemctl restart mariadb
    
     
  5. serdarka

    serdarka New Member

    6
    0
    1
    Jan 11, 2019
    Ratings:
    +0
    Local Time:
    4:02 PM
    service mysqld status


    gives me Failed to start MariaDB 10.1.37 database server.

    systemctl restart mysql

    gives
    Job for mariadb.service failed because a timeout was exceeded. See "systemctl status mariadb.service" and "journalctl -xe" for details.

    systemctl status mariadb.service gives
    mariadb.service - MariaDB 10.1.37 database server
    Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
    Drop-In: /etc/systemd/system/mariadb.service.d
    └─migrated-from-my.cnf-settings.conf, openfileslimit.conf, protecthome.conf
    Active: failed (Result: timeout) since Thu 2019-01-10 19:51:23 UTC; 2min 6s ago
    Docs: man:mysqld(8)
    systemd
    Process: 26927 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=exited, status=0/SUCCESS)
    Process: 26656 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= || VAR=`/usr/bin/galera_recovery`; [ $? -eq 0 ] && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1 (code=exited, status=0/SUCCESS)
    Process: 26655 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
    Main PID: 26927 (code=exited, status=0/SUCCESS)


    Do you recommend to reinstall centos and centmin mod from beginning?
     
  6. eva2000

    eva2000 Administrator Staff Member

    38,678
    8,540
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +13,123
    Local Time:
    2:02 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
  7. eva2000

    eva2000 Administrator Staff Member

    38,678
    8,540
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +13,123
    Local Time:
    2:02 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    If it's fresh install with no data, yes easiest way is do a reinstall of centos and fresh centmin mod install and see if the problem persists
     
  8. serdarka

    serdarka New Member

    6
    0
    1
    Jan 11, 2019
    Ratings:
    +0
    Local Time:
    4:02 PM
    Yes good idea :)
    Okay I reinstall see how it goes

    do you recommend this code
    curl -sL http://centminmod.com/betainstaller.sh | bash
    or somethign else?

    thank you for your help
     
  9. eva2000

    eva2000 Administrator Staff Member

    38,678
    8,540
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +13,123
    Local Time:
    2:02 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
  10. serdarka

    serdarka New Member

    6
    0
    1
    Jan 11, 2019
    Ratings:
    +0
    Local Time:
    4:02 PM
..