Skip to content

Cannot connect via Unix socket #37

Description

@allenap

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions