Skip to content
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

"localhost" doesn't work for MySQL, only "127.0.0.1" #75

Open
theDanielJLewis opened this issue Aug 12, 2013 · 3 comments
Open

"localhost" doesn't work for MySQL, only "127.0.0.1" #75

theDanielJLewis opened this issue Aug 12, 2013 · 3 comments

Comments

@theDanielJLewis
Copy link

Oddly, nothing related to MySQL works when I use "localhost," as this appears to use a socket that isn't available in MNPP. (I'm not exactly sure I understand this.)

But if I use "127.0.0.1" instead of localhost, it works fine.

What's going on wrong?

I do have localhost assigned in my hosts.

@marcosgdf
Copy link

It's not the same localhost and 127.0.0.1 for mysql connections.

http://serverfault.com/questions/295285/mysql-cannot-connect-via-localhost-only-127-0-0-1

@Daniel15
Copy link

It's because the socket filename is incorrect.

This is in the MySQL configuration:

socket          = /Applications/MNPP/tmp/mysql/mysql.sock

The path in php.ini needs to be updated to reflect this:

[mysql]
mysql.default_socket = /Applications/MNPP/tmp/mysql/mysql.sock
[mysqli]
mysqli.default_socket = /Applications/MNPP/tmp/mysql/mysql.sock
[pdo_mysql]
pdo_mysql.default_socket = /Applications/MNPP/tmp/mysql/mysql.sock

@majidmushtaq91
Copy link

@Daniel15 your solution worked for me thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants