2

I just installed Magento 2.1.9 on CentOS 7.4. I have configured MySql 5.7.17. I am using the web-based Setup Wizard.

On the step for 'Add a Database' I get the error

SQLSTATE[HY000] [2002] Permission denied

My MySql server is on a separate host from my Magento2. I am able to connect to the MySql server using command line from the Magento2 server.

How can I get past this error in the web-based Setup Wizard?

 mysql> SHOW GRANTS FOR CURRENT_USER; +------------------------------------------------------+ | Grants for magento@% | +------------------------------------------------------+ | GRANT USAGE ON *.* TO 'magento'@'%' | | GRANT ALL PRIVILEGES ON `magento`.* TO 'magento'@'%' | +------------------------------------------------------+ 2 rows in set (0.01 sec) 
4
  • 1
    Database and user which you are using is having all rights on database ? Commented Sep 28, 2017 at 4:05
  • Yes. I have updated the original post with the details of privileges. The user has all privileges. Commented Sep 28, 2017 at 4:12
  • 1
    stackoverflow.com/a/44092808/7472487 check this post once. Commented Sep 28, 2017 at 4:16
  • @irfan-momin thanks, work for me Commented Sep 16, 2024 at 6:41

1 Answer 1

3

The issue turned out to be the SELinux security policies.

By default, the policy httpd_can_network_connect_db is disabled (meaning that your web server cannot contact a remote DB.)

You can check this using:

getsebool -a | grep httpd

in case httpd_can_network_connect_db is Off, then you can enable using:

setsebool -P httpd_can_network_connect_db 1

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.