wp cli – WordPress Import (CLI) returns Error Establishing a database connection

Question

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.

Note:

  1. Old server runs http and New Server runs https
  2. 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.

WordPress 5.6

Update: Found the solution with this SO.

0
Mr. Kenneth 5 months 2022-03-14T19:51:07-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse