wp cli – WordPress Import (CLI) returns Error Establishing a database connection
I am trying to use the
wp import cli in the terminal to import a large wxr file (200MB) from the old test server to new test server. I can login to wp-admin using the admin account and mysql cli
mysql -u user -p so I know that my db information is correct. But when I use wp import command, returns db error
Error Establishing a database connection. Is there any part that I am missing? I am checking other SO questions and other website articles but no luck so far.
- Old server runs http and New Server runs https
- Old and New Server has user and password
Regarding note 2, I don’t think it matters since I was able to import from test server to my local server without problems before.
The complete error message when I turn on debug is :
PHP Warning: mysqli_real_connect(): (HY000/2002): No such file or directory in /project-path/wp-includes/wp-db.php on line 1653 Warning: mysqli_real_connect(): (HY000/2002): No such file or directory in /project-path/wp-includes/wp-db.php on line 1653 Error: Error establishing a database connection.
Update: Found the solution with this SO.