skip to Main Content

“Cannot connect: invalid settings.
mysqli_real_connect(): (HY000/2002): No connection could be made because the target machine actively refused it.
Connection for controluser as defined in your configuration failed.
mysqli_real_connect(): (HY000/2002): No connection could be made because the target machine actively refused it.
phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in your configuration and make sure that they correspond to the information given by the administrator of the MySQL server.”

2

Answers


  1. Depending on your environment, OS (Linux/Windows..), you should make sure the mysql/mariadb service is running.

    ps aux | grep mysqld mysql 15202 0.3 8.5 1065616 175388 ?
    Ssl Jan16 565:04 /usr/sbin/mysqld

    and which port is listening to :

    netstat -tulnp | grep mysqld tcp 0 0 127.0.0.1:3306
    0.0.0.0:* LISTEN 15202/mysqld

    Second, make sure the credentials defined in your configuration actually exist an have the proper rights inside mysql

    If the mysql/mariadb service is running, you can connect and check :
    from os shell :

    # mysql -u [your_user] -p[your_password] -D mysql

    MariaDB [mysql]> select user from user;

    here you should find your user as defined in file “wp-config.php”, where wordpress should store mysql connection data.

    Examples are from Linux, since I think is the most common, but if you share more on your environment, the answer could be more accurate.

    Login or Signup to reply.
  2. Locate config.inc.php

    find this,

    $cfg['Servers'][$i]['host'] = 
    

    if there is localhost change it to 127.0.0.1

    Like this

    Change

    $cfg['Servers'][$i]['host'] = 'localhost';
    

    into

    $cfg['Servers'][$i]['host'] = '127.0.0.1';
    

    Save.
    Then restart your local server.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search