'Permission denied' connecting from instance to database


I cannot connect from my Lightsail instances to the Lightsail database, always 'permission denied'.
I can connect to the same database remotely with public mode enabled.

In my app I have the connection string defined as:

'db' =>
			'dsn'         => 'mysql:dbname=dbmaster;host=endpoint;port=3306',
			'username'    => 'username',
			'password'    => 'password',
			'persistent'  => false,
			'log_queries' => false,
			'reconnect'   => false,
			'queries'     =>

Edited by: Lester on Apr 7, 2020 6:05 PM
Preview looks fine, published version not same, special characters converted to html entity codes.

asked 4 years ago293 views
1 Answer

If anyone else encounters this, this was the reason:

"..By default, the httpd_can_network_connect_db Boolean is off, preventing Apache HTTP Server scripts and modules from connecting to database servers.."


setsebool -P httpd_can_network_connect_db on

answered 4 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions