Unable to connect to the specified MySQL server

Discussion in 'Installation/Configuration' started by raykom2010, Apr 20, 2020.

Tags:
  1. raykom2010

    raykom2010 New Member

    Hello.
    During installation of ispcpnfig after answering questions from the installation script
    MySQL server port [3306]:
    MySQL root username [root]:
    MySQL root password []: xxxxxxxxxxxxxx
    MySQL database to create [dbispconfig]:
    MySQL charset [utf8]: utf8mb4

    I get an error:
    MySQL server hostname [localhost]: Unable to connect to the specified MySQL server php_network_getaddresses: getaddrinfo failed: Name or service not known

    Console command
    mysqladmin -u root -p version
    returns such an answer:
    mysqladmin Ver 9.1 Distrib 10.3.22-MariaDB, for debian-linux-gnu on x86_64
    Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
    Server version 10.3.22-MariaDB-0+deb10u1
    Protocol version 10
    Connection Localhost via UNIX socket
    UNIX socket /var/run/mysqld/mysqld.sock
    Uptime: 1 hour 31 min 33 sec

    Tell me where the problem is.
    Thanks.
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    The error means that localhost can not be resolved. The console command you used for testing is not correct as a test for this scenario though as it does not test if MySQL is reachable on localhost, it tests only if you can connect to MySQL through its socket. Check the /etc/hosts file on your system and ensure that localhost is configured correctly in there. Example of a /etc/hosts file:

    Code:
    [email protected]:~# cat /etc/hosts
    127.0.0.1       localhost
    192.168.0.100   server1.example.com     server1
    
    # The following lines are desirable for IPv6 capable hosts
    ::1     localhost ip6-localhost ip6-loopback
    ff02::1 ip6-allnodes
    ff02::2 ip6-allrouters
     

Share This Page