Skip to content

Make the default socket path distribution-specific #794

@gfrlv

Description

@gfrlv

When the socket path is not specified in my.cnf, we try the hardcoded value /var/run/mysqld/mysqld.sock. However, this is not a universal constant: the docs specify /tmp/mysql.sock as the default location, and in different distribution packages of mysql it is variously overriden. Here is an old blog post where someone collected the following default paths:

OS socket location
Non-Linux e.g. FreeBSD or Solaris /tmp/mysql.sock
Debian-based e.g. Ubuntu, and archlinux /var/run/mysqld/mysqld.sock
SUSE (after v11.2) /var/run/mysql/mysql.sock
Red Hat, and SUSE (before v11.2) /var/lib/mysql/mysql.sock
archlinux (very old versions) /tmp/mysqld.sock

I suggest putting the default socket location into the .myclirc file. In theory, it would then be a package maintainer's job to specify the correct path for each distribution, but since many distribution packages are not maintained, we could probably do some guesswork in setup.py

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions