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

Cannot connect via Unix socket #37

Open
allenap opened this issue Oct 1, 2019 · 2 comments
Open

Cannot connect via Unix socket #37

allenap opened this issue Oct 1, 2019 · 2 comments

Comments

@allenap
Copy link

allenap commented Oct 1, 2019

I'm having problems connecting to MySQL 5.7 on macOS, using version 0.1.6 (from LTS Haskell 12.26). I get:

ConnectionError {
    errFunction = "connect",
    errNumber = 2002,
    errMessage = "Can't connect to MySQL server on 'localhost' (22)"
}

I have a mysqld running in a temporary folder, to which I can connect manually with mysql and ping it with mysqladmin. The parameters I'm using to connect:

ConnectInfo {
    connectHost = "localhost",
    connectPort = 0,
    connectUser = "gavin",
    connectPassword = "",
    connectDatabase = "test",
    connectOptions = [CharsetName "utf8", Protocol Socket],
    connectPath = "/some/temp/dir/mysqld.sock",
    connectSSL = Nothing
}

I've tried variations of connectHost and connectPort without success. The mysql_real_connect docs suggest that "localhost" is appropriate for host when trying to connect via a Unix socket.

I'm using a binary distribution of MySQL 5.7 from Oracle. mysqld was launched with:

        System.Process.spawnProcess "/path/to/mysql/bin/mysqld"
          [ "--no-defaults",
            "--skip-networking",
            "--datadir=/some/temp/dir/data",
            "--lc-messages-dir=/path/to/mysql/share",
            "--explicit_defaults_for_timestamp",
            "--skip-ssl",
            "--pid-file=/some/temp/dir/mysqld.pid",
            "--socket=/some/temp/dir/mysqld.sock",
            "--tmpdir=/some/temp/dir/tmp",
            "--user=gavin"
            ]

Any ideas? Thanks!

@paul-rouse
Copy link
Owner

I can't see an obvious problem there. I can run an application which uses "localhost" to connect via a Unix socket on Ubuntu, so I think it must be a configuration or permission issue.

@allenap
Copy link
Author

allenap commented Oct 4, 2019

Thank you for checking. I'll keep trying things, and I'll update here if I figure something out.

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