Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for check unix socket in LudicrousDB::check_tcp_responsiveness() #184

Open
AkramiPro opened this issue Nov 12, 2024 · 0 comments

Comments

@AkramiPro
Copy link

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,
] );
AkramiPro added a commit to AkramiPro/ludicrousdb that referenced this issue Nov 12, 2024
AkramiPro added a commit to AkramiPro/ludicrousdb that referenced this issue Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant