0

I am trying to connect to Magento database of another system with the following configuration in app/etc/env.php

  array (
    'host' => '192.168.1.172',
    'dbname' => 'datacenter',
    'username' => 'root',
    'password' => 'root',
    'active' => '1',
  ),

But I keep getting the below error, is there anything I can do to fix it? Your inputs are much appreciated.

2 exception(s): Exception #0 (Zend_Db_Adapter_Exception): SQLSTATE[HY000] [2002] Connection refused Exception #1 (PDOException): SQLSTATE[HY000] [2002] Connection refused

1
  • MySQL is running? in your 192.168.1.172
    – Bojjaiah
    Apr 14, 2021 at 8:24

1 Answer 1

0

You should have to allow mysql connection from remote user.

here your remote machine is your magento instances

Edit my.cnf/my.ini file changing bind-address parameter to:

bind-address = 0.0.0.0

Also, make that skip-networking parameter is not defined.

For Linux:

/etc/mysql/my.cnf Debian/Ubuntu

/etc/my.cnf CentOS/CloudLinux/RHEL

For Windows:

"%plesk_dir%\MySQL\my.ini" for Plesk databases(port 8306)

"%plesk_dir%\Databases\MySQL\my.ini" for Clients databases(port 3306)

After that, restart MySQL server.

Look more for detail

Magento Doc OR Plesk

hope this will work for you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.