Skip to content

DATABASE_URL 127.0.0.1 versus localhost #21918

@Mynyx

Description

@Mynyx

The Databases / Doctrine documentation (https://symfony.com/doc/current/doctrine.html#configuring-the-database) contains various examples for DATABASE_URL with 127.0.0.1 as host.

Using localhost as host would have the advantage that a faster Unix domain socket is used, if available, instead of TCP/IP:

Note: Unix only: When the host name is set to "localhost", then the connection to the server is made through a domain socket. ...
https://www.php.net/manual/en/ref.pdo-mysql.connection.php#refsect1-ref.pdo-mysql.connection-notes

Are there any other differences between 127.0.0.1 and localhost which make 127.0.0.1 appear preferable?

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