简体   繁体   中英

Installing Drupal on AWS EC2 with Acquia DB: SQLSTATE[HY000] [2002] Connection refused

I have a Drupal 8 site built on my local machine with Acquia Dev Desktop. I am installing Drupal on AWS EC2, and am running into the following error.

Failed to connect to your database server. The server reports the 
following message: SQLSTATE[HY000] [2002] Connection refused.

I have checked the db name, username, password, and port with my config.inc file, and still can't get it to connect. Here is a screenshot of the drupal install page with the error:

在此处输入图片说明

and this is my config.inc file info (with dummy password, but the real version does match what I am inputting in Drupal install page)

/*
 * First server
  */
 $i++;
 /* Authentication type */
 $cfg['Servers'][$i]['auth_type'] = 'config';
 /* Server parameters */
 $cfg['Servers'][$i]['host'] = '127.0.0.1';
 $cfg['Servers'][$i]['port'] = '33067';
 $cfg['Servers'][$i]['connect_type'] = 'tcp';
 $cfg['Servers'][$i]['compress'] = false;
 /* Select mysqli if your server has it */
 $cfg['Servers'][$i]['extension'] = 'mysql';

 /* rajk - for blobstreaming */
 $cfg['Servers'][$i]['bs_garbage_threshold'] = 50;
 $cfg['Servers'][$i]['bs_repository_threshold'] = '32M';
 $cfg['Servers'][$i]['bs_temp_blob_timeout'] = 600;
 $cfg['Servers'][$i]['bs_temp_log_threshold'] = '32M';

 $cfg['Servers'][$i]['user']          = 'root';
 $cfg['Servers'][$i]['password']      = 'mypasswordhere';
 $cfg['Servers'][$i]['AllowNoPassword'] = false;

 $cfg['AllowUserDropDatabase'] = true;

Take a look on this answer. Because if you're using RHEL/CentOS machine could be solution.

Edit: RHEL/CentOS or any other EC2 system with SELinux enabled.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM