Skip to content

php hangs when auth_socket is set for the user #19222

@jonashrem

Description

@jonashrem

Description

The following code:

<?php
$mysqli = new mysqli("localhost", "root", "...", "mysql");

echo $mysqli->host_info . "\n";

with a local MySQL 8.4 User like this:

*************************** 6. row ***************************
                    Host: localhost
                    User: root
...
                  plugin: auth_socket

Results in php hanging until MySQL timeouts instead of connecting to MySQL

Changing the auth plugin to caching_sha2_password solves the situation. I did not test what happens when I don't set the password or explicitly use the socket.

PHP Version

PHP 8.4.1 (cli) (built: Nov 25 2024 18:04:19) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.4.1, Copyright (c) Zend Technologies
    with Zend OPcache v8.4.1, Copyright (c), by Zend Technologies

Operating System

Ubuntu 24.04

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions