-
Notifications
You must be signed in to change notification settings - Fork 81
Open
Description
Problem
some users set skip-networking in my.conf, this setting disables TCP/IP networking for MySQL, allowing only local socket connections (i.e., connections from the same server). It’s useful for securing MySQL in environments where external access isn't necessary.
PHP Warning: fsockopen(): unable to connect to localhost:3306 (Connection refused)
Disable TCP Check
i try to set $wpdb->check_tcp_responsiveness = false; but after that i got this warning:
[12-Nov-2024 18:10:10 UTC] WordPress database error 2024-11-12 18:10:10 Can't select master__r -
'referrer' => '..........',
'host' => localhost,
'tcp_responsive' => ,
'lagged_status' => 3 for query SELECT * FROM .........
Solution
Check unix socket instead of $host and $port to fix this warning.
$wpdb->add_database( $master = [
'host' => 'localhost:3306:/var/lib/mysql/mysql.sock',
'user' => '.....',
'password' => '......',
'name' => '.......',
'dataset' => 'master',
'read' => 1,
'write' => 1,
'timeout' => 0.2,
] );
Metadata
Metadata
Assignees
Labels
No labels