Skip to content

MySQL: Connections to localhost fail without sockets #2576

Description

@psgreco

Description

Trying to connect to localhost via MySQL/TCP-IP fails if the socket is not available (In my case, port 3306 is already redirected externally via ssh). The error says Can't connect to local server through socket '' (111).

If I'm understanding the documentation correctly (https://dev.mysql.com/doc/c-api/8.4/en/mysql-real-connect.html), the problem is that in

PAnsiChar(Utf8Encode(FinalSocket)),
PAnsiChar(Utf8Encode(FinalSocket)) is sending an empty string instead of nil, because the library treats localhost as a special case.

Changing hosntame to 127.0.0.1 acts as a workaround for now

HeidiSQL version and OS

12.21 linux GTK3 (rpm)

Database server version

Reproduction recipe

  1. Disable sockets in mysql (or connect to a remote server via ssh and redirect tcp port)
  2. Connect to "localhost"

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugDefective behaviour in HeidiSQL

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions