0

Here is my function for external database connection and using connection factory class to create connection, it is working fine in 2.3.3. //use Magento\Framework\App\ResourceConnection\ConnectionFactory;

public function getConnection(){    
 $db = $this->connectionFactory->create(
            [
                'host' => XX.XXX.XXX.X,
                'dbname' => 'dbname',
                'username' => 'username',
                'password' => 'password',
                'active' => '1',
            ]
        );
    return $db;
}

However when i tested it in 2.3.4 i am getting this error

Exception #0 (Zend_Db_Adapter_Exception): SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost'
Exception #1 (PDOException): SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost'

Note: host is external IP of the database that i am using to connect.

1
  • Host name was not coming correctly,once I fixed the host name it started work Commented Apr 3, 2020 at 9:51

2 Answers 2

0

it looks like to me that you tried to access the database as root which is not allowed. Are you running the db inside of a docker container?

0

Host name was not coming correctly,once I fixed the host name it started work

0

Your Answer

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

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