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?
- Does the database exist, and have you entered the correct database name?
- Have you entered the correct username and password?
- Have you entered the correct database hostname?
*Check*
*Check*
*Check*
*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
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | improveErrorMessage-1409108-1.patch | 1.24 KB | gary4gar |
Comments
Comment #1
gary4gar commentedPatched included
PS: this is silly but its my first patch :D
Comment #2
gary4gar commentedBug Status changed
Comment #3
gary4gar commentedI think this is the correct status
Comment #4
dkinzer commentedYeah, I think that would be useful in some cases.
Comment #5
David_Rothstein commentedThe 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.
Comment #6
David_Rothstein commentedBy 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.
Comment #7
David_Rothstein commentedOh, and by the way, thanks @gary4gar for your first patch! Welcome :)
Comment #8
schnippy commentedLanded 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.
Comment #9
mgiffordThis still a concern in D8? Unassigned issue too.
Comment #10
cameron tod commentedComment #11
cameron tod commentedComment #24
danielvezaNo 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.