-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Try both 127.0.0.1 (port) and localhost (socket) when using the installer #2520
Comments
Thanks for filing this issue @DrupaListo-com. I've been encountering this same problem for a while now as well, and now I know what the cause of the problem is. There are many, many people who seem to run into this problem. For example: https://serverfault.com/questions/295285/mysql-cannot-connect-via-localhost-only-127-0-0-1 You can read any of those posts and they all come to the same conclusion: When you use What happens frequently is that PHP and MySQL are not reading/writing to the same place. This can happen on any platform, and it's very common when you combine two different solutions locally. For example, if you use Homebrew Apache and the built-in MacOS MySQL. Or if you use multiple MAMP/WAMP stacks for PHP, but use a common MySQL between them. The socket location is usually in the
While PHP configures its socket in
If those two files are pointing at different sockets, things will not work. It also explains the error message "No such file or directory." It means PHP was looking for the socket file, but it wasn't there. I'm not certain what the best solution is here. Just switching from localhost to 127.0.0.1 would probably have fewer problems, though it would necessitate the minor overhead of using TCP/IP instead of a socket file. Benchmarking has shown that to to be negligible these days. Showing a better error message would also definitely help. I'm not entirely sure attempting to fix the connection values and use localhost instead of 127.0.0.1 or vice-versa would be a good thing. Though it is inline with what we are discussing over in #496 (automatically create the database if it does not exist). Anything that reduces the installation friction is a huge boon. |
I've combined a fix for this into the PR at backdrop/backdrop#2126. It does the following:
This combines with automatically creating the database as discussed in #496. |
This is fixed in backdrop/backdrop#2126 |
error: Failed to connect to your database server. The server reports the following message: No such file or directory.
I think my mariadb/mysql setup on the server is pretty standard and default.
Since a while, mysql client-server combo don't use tcp/networking to talk, but use sockets...
So using a hostname = "localhost" is invalid in many situations while 127.0.0.1 - is valid.
And finally: trying to install backdrop with the default host = localhost - fails with such an unfriendly message - see above - that it;s disgusting!
For better UX we should at least add a hint when host=localhost in one of two ways:
Ideally, the installer should test with host=localhost first and if it fails - try 127.0.0.1, and when this fails too - then give some error.
I don't know if being smart in such a way could endanger security, break things... if it could, then at least the hints/better UX proposal from above would do just fine!
PR by @quicksketch: backdrop/backdrop#2126
The text was updated successfully, but these errors were encountered: