'Permission denied' connecting from instance to database

0

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'     =>
			[
				'SET NAMES UTF8',
			],
		],

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

Lester
질문됨 4년 전342회 조회
1개 답변
0

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.."

https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/selinux_users_and_administrators_guide/sect-security-enhanced_linux-working_with_selinux-booleans

setsebool -P httpd_can_network_connect_db on

Lester
답변함 4년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠