Problem/Motivation

I tried to install Drupal and got an error of "Failed to connect to your database server.". I double & triple checked all the things given by drupal:

  • Is the database server running?
  • *Check*

  • Does the database exist, and have you entered the correct database name?
  • *Check*

  • Have you entered the correct username and password?
  • *Check*

  • Have you entered the correct database hostname?

*Check*

And yet Drupal didn't connect. It turns out mysql unix_socket location was wrong! I figured it out but I wasted about 2hours figuring out what is wrong.

Proposed resolution

Its a silly thing but If we could add that socket thing in the error message itself, it would help save some time for people having the problem like me.

Have you checked location of unix socket file & verified that file does exist?

In future, this error message might save some time.

Remaining tasks

It would be cool if, we can specify custom location for socket file in database(ADVANCED OPTIONS) UI.

User interface changes

N/A

API changes

N/A

CommentFileSizeAuthor
#1 improveErrorMessage-1409108-1.patch1.24 KBgary4gar

Comments

gary4gar’s picture

Assigned: Unassigned » gary4gar
StatusFileSize
new1.24 KB

Patched included

PS: this is silly but its my first patch :D

gary4gar’s picture

Status: Active » Patch (to be ported)

Bug Status changed

gary4gar’s picture

Status: Patch (to be ported) » Needs review

I think this is the correct status

dkinzer’s picture

Status: Needs review » Reviewed & tested by the community

Yeah, I think that would be useful in some cases.

David_Rothstein’s picture

Status: Reviewed & tested by the community » Needs work

The new sentence seems to have some grammatical errors.

Also, is this really a common enough error that we want to include it in the message? It seems like an edge case, and the error message you get on the screen in this case already links to http://drupal.org/documentation/install so it seems like the kind of detailed documentation that belongs somewhere in there.

If the current wording of the message is confusing (in the sense that it implies the four listed problems are a complete "checklist", rather than just examples of common problems) I think it would be better to reword the message to make that clear, rather than continuing to add new bullet points to the list.

David_Rothstein’s picture

By the way, for anyone testing this patch on Drupal 8 currently, note that you probably won't see this message appear at all until #1506630: Namedspaced code throws and catches "Exceptions" which don't exist (causing the DB settings form validation to break on install) is fixed.

David_Rothstein’s picture

Oh, and by the way, thanks @gary4gar for your first patch! Welcome :)

schnippy’s picture

Landed here from Google with the same issue, this discussion helped me resolve it so I’ll contribute my value-add.

I got this error while trying to install MySQL server from their install package for OS X. According to the MySQL documentation, the default location is different for OS X MySQL installations which was causing this error. I had to update my php.ini file to change this value “pdo_mysql.default_socket” to point to the correct location for my installation (/var/mysql/mysql.sock) [ more on this setting on php.net ]

That said – I would tend to agree that this is probably an edge case (most users will be fine with the default php setting) and would be better handled in the install documentation rather than as an additional error message. I'm going to add these notes to the installation troubleshooting FAQ.

mgifford’s picture

Version: 8.0.x-dev » 8.1.x-dev
Assigned: gary4gar » Unassigned
Issue summary: View changes

This still a concern in D8? Unassigned issue too.

cameron tod’s picture

cameron tod’s picture

Priority: Minor » Normal

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.0-beta1 was released on March 2, 2016, which means new developments and disruptive changes should now be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.0-beta1 was released on August 3, 2016, which means new developments and disruptive changes should now be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

danielveza’s picture

Status: Needs work » Closed (won't fix)
Issue tags: +Bug Smash Initiative

No updates in 6 years seems to suggest this isn't a common enough error & relates more to server configuration rather than Drupal. We can reopen or work on this in a folllow up task if it starts happening more often.