You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On my macOS system, I have MySQL set up to listen at /usr/local/var/mysql/mysql.sock. I have this correctly configured in my php.ini and mysql server/client config files so that everything works as normal.
For some reason, the wp db command seems to have the --no-defaults flag so all mysql client settings are ignored. This causes all wp db commands to fail as it falls back to the old socket path at the time MySQL was compiled.
I'm wondering what the thought process was behind this flag? As far as I know the defaults can be easily overridden by specifying the flags, so I can't see what purpose this has. I found the commits where this was added, but no mention of why.
Describe how other contributors can replicate this bug
Create custom MySQL socket path and make sure it is available and listening
Set this socket path in php.ini and mysql client config
Try wp db import or wp db export
Example
~> mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 91809
Server version: 10.4.9-MariaDB Homebrew
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> exit
Bye
~> mysql --no-defaults
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
Describe what you would expect as the correct outcome
The wp db command should correctly pick up the default socket path from the PHP ini or default MySQL client settings.
Let us know what environment you are running this on
@Muffinman This will be fixed in the next release via #157 through the addition of a --defaults flag which counters the default --no-defaults behavior. This behavior is still the default, though, for backwards compatibility reasons.
Bug Report
Describe the current, buggy behavior
On my macOS system, I have MySQL set up to listen at /usr/local/var/mysql/mysql.sock. I have this correctly configured in my php.ini and mysql server/client config files so that everything works as normal.
For some reason, the
wp db
command seems to have the--no-defaults
flag so all mysql client settings are ignored. This causes allwp db
commands to fail as it falls back to the old socket path at the time MySQL was compiled.I'm wondering what the thought process was behind this flag? As far as I know the defaults can be easily overridden by specifying the flags, so I can't see what purpose this has. I found the commits where this was added, but no mention of why.
4fb8599
0bcaa75
Describe how other contributors can replicate this bug
wp db import
orwp db export
Example
Describe what you would expect as the correct outcome
The
wp db
command should correctly pick up the default socket path from the PHP ini or default MySQL client settings.Let us know what environment you are running this on
Provide a possible solution
Remove
--no-defaults
from mysql commands, or attempt to fetch socket path from PHP / MySQL.The text was updated successfully, but these errors were encountered: