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 forces socket even when path is set to "" #10

Open
LeviSchuck opened this issue May 10, 2014 · 1 comment
Open

Localhost forces socket even when path is set to "" #10

LeviSchuck opened this issue May 10, 2014 · 1 comment

Comments

@LeviSchuck
Copy link

It's annoying to have to use "0.0.0.0" because using "localhost" forces it to try to use a socket, even if it doesn't exist.

If you're going to try to use the socket and be helpful, don't fail if we provide a port.

@thomasjm
Copy link

I looked into this a little and it seems that this is actually a MySQL quirk. A couple lines from the docs:

  • If host is NULL or the string "localhost", a connection to the local host is assumed:
  • On Unix, the client connects using a Unix socket file. The unix_socket parameter or the MYSQL_UNIX_PORT environment variable may be used to specify the socket name.

So it doesn't seem to be the fault of mysql-simple.

However, I was confused that even when I pass connectOptions = [Protocol TCP] in the ConnectInfo, it still tries to use the socket. I would have thought that this option would be the same as --protocol=tcp when using the MySQL CLI client. Indeed, the docs also say

  • You can also influence the type of connection to use with the MYSQL_OPT_PROTOCOL or MYSQL_OPT_NAMED_PIPE options to mysql_options().

I see that mysql_options is theoretically getting called as part of the connect process in the wrapper library below this one:

https://github.com/paul-rouse/mysql/blob/master/Database/MySQL/Base.hs#L286

Is it possible there's some problem passing the connect options to MySQL? I'll keep looking into this...

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

2 participants