Answers.Body: <p>In my experience if 'localhost' (or your host) was refusing to connect on default port with all credentials/permissions definitely correct, specifying 'localhost:3306' will work (even though you shouldn't have to specify the :3306, and I think it tells you as much).</p>
  
  <p>I will also note that this is something I have only experienced recently, and with this question there are examples on Ubuntu, and in my case MAMP.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-07-07T22:11:38.337Z
Answers.LastActivityDate: 2017-07-07T22:11:38.337Z
Answers.UserDisplayName: Eli Lisseck
Body: <p>I am using Drupal 7.56 and CiviCRM 4.7.21 on Ubuntu 16.04. The Apache and MySQL servers run on the same host.</p>
  
  <p>The Drupal and CiviCRM databases are stored on the same server, and are accessed with a single user. Drupal is happy and works just fine. But CiviCRM, using the same user as Drupal, cannot connect to the database.</p>
  
  <p>The error message appears under the headings "CiviCRM Database Details" and "Drupal Database Details", in the following row:</p>
  
  <pre><code>Are the access credentials correct? | That username/password doesn't work:
  </code></pre>
  
  <p>Here's what I've done so far</p>
  
  <ul>
  <li>I have triple checked that I am not making any typos.</li>
  <li>I have verified that I can log into the MySQL account using the MySQL shell.</li>
  <li>I have verified that MySQL is listening on the default port.</li>
  <li>I have verified that MySQL is binding to 127.0.0.1.</li>
  <li>I have verified that there is no firewall in the way.</li>
  <li>I have tried out opening the server to remote connections and making the MySQL user able to log in remotely. I successfully connected with Sequel Pro, but CiviCRM didn't budge. I closed things down again.</li>
  </ul>
  
  <p>I am a loss for what else I can try. Is there something special about how CiviCRM connects to MySQL? After all, Drupal is having no problems.</p>
  
  <p>I notice that the error message ends with a colon, which implies that there is supposed to be some additional information. Does this imply that there may be a bug?</p>
  
  <p>Thanks very much!</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-07-07T18:37:08.937Z
Comments.Text: Have you tried adding the port to the hostname even though it is default? I've run into a strange environment issue before where 'localhost' was refusing to connect, but specifying 'localhost:3306' worked (even though you shouldn't have to specify the :3306 and I think it tells you as much).
Comments.UserDisplayName: Eli Lisseck
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-07-07T21:29:33.640Z
Comments.Text: @EliLisseck That did it! Thank you so much, that's something I never would have tried on my own. You should add it as an answer to this question so I can put down that you solved it.
Comments.UserDisplayName: user4831
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-07-07T22:22:03.940Z
Comments.Text: sounds unrelated, but flagging that seems to be discussion around problems with 4.7.21 release in terms of new installs here: https://chat.civicrm.org/civicrm/pl/bssib8drn3ywixkzisq9swa5mw
Comments.UserDisplayName: petednz - fuzion
Tags: <drupal><database><installation><mysql><authentication>
Title: Why is the CiviCRM installer unable to connect to the MySQL server?
ThreadText: # Why is the CiviCRM installer unable to connect to the MySQL server?
  
  (Asked by: username_0 on 2017-07-07)
  
  I am using Drupal 7.56 and CiviCRM 4.7.21 on Ubuntu 16.04. The Apache and MySQL servers run on the same host.
  The Drupal and CiviCRM databases are stored on the same server, and are accessed with a single user. Drupal is happy and works just fine. But CiviCRM, using the same user as Drupal, cannot connect to the database.
  The error message appears under the headings "CiviCRM Database Details" and "Drupal Database Details", in the following row:
  Are the access credentials correct? | That username/password doesn't work:
  
  Here's what I've done so far
  
  I have triple checked that I am not making any typos.
  I have verified that I can log into the MySQL account using the MySQL shell.
  I have verified that MySQL is listening on the default port.
  I have verified that MySQL is binding to 127.0.0.1.
  I have verified that there is no firewall in the way.
  I have tried out opening the server to remote connections and making the MySQL user able to log in remotely. I successfully connected with Sequel Pro, but CiviCRM didn't budge. I closed things down again.
  
  I am a loss for what else I can try. Is there something special about how CiviCRM connects to MySQL? After all, Drupal is having no problems.
  I notice that the error message ends with a colon, which implies that there is supposed to be some additional information. Does this imply that there may be a bug?
  Thanks very much!
  
  **Tags:** drupal, database, installation, mysql, authentication
  
  > **Comments:**
  > **username_1**: Have you tried adding the port to the hostname even though it is default? I've run into a strange environment issue before where 'localhost' was refusing to connect, but specifying 'localhost:3306' worked (even though you shouldn't have to specify the :3306 and I think it tells you as much).  
  > **username_0**: @EliLisseck That did it! Thank you so much, that's something I never would have tried on my own. You should add it as an answer to this question so I can put down that you solved it.  
  > **username_2**: sounds unrelated, but flagging that seems to be discussion around problems with 4.7.21 release in terms of new installs here: https://chat.civicrm.org/civicrm/pl/bssib8drn3ywixkzisq9swa5mw  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2017-07-07. Score: 2 | Accepted answer
  
  In my experience if 'localhost' (or your host) was refusing to connect on default port with all credentials/permissions definitely correct, specifying 'localhost:3306' will work (even though you shouldn't have to specify the :3306, and I think it tells you as much).
  
  I will also note that this is something I have only experienced recently, and with this question there are examples on Ubuntu, and in my case MAMP.
  
  
  ---
  
  