We are sorry to hear that you’re having trouble using Yoast SEO. It’s very odd that you’re seeing the ‘Error establishing a database connection.’ error when running wp yoast index
command from WP-CLI.
It seems your current web server can’t handle the relevant request and as such, the database server goes down. In this case, we highly recommend you please reach out to your web hosting provider to see why exactly the database server is going down when running the relevant command.
Note: before running the relevant command again next time, make sure that you reset the Indexables tables and migrations by following the steps given below:
- Install and activate Yoast Test Helper plugin;
- Go to Tools → Yoast Test → Yoast SEO → Reset indexables tables & migrations options to reset it;
- Run SEO data optimization from the SEO → Tools page.
Let us know what happens next and what you find out after reaching out to your web hosting provider.
Thread Starter
inspry
(@inspry)
Hello,
We went ahead and followed your steps and got stuck with another error on the last step when trying to run the SEO data optimizer:
Can you guide us on how to fix?
Thanks!
-
This reply was modified 2 years, 6 months ago by inspry.
The relevant error you’re now seeing typically occurs when the HTTP response has the wrong JSON format or something else going on with the HTTP response. We recommend you run the Indexables through the command line after resetting the Indexables tables and migrations.
If running the Indexables through the command line completes it successfully, you could then run the SEO data optimization from the SEO → Tools page.
Plugin Support
Suwash
(@suascat_wp)
@koreatownlosangeles
To run the indexable via the command line, please check this guide.
We are going ahead and mark this topic as resolved due to inactivity. If you require any further assistance, feel free to create a new topic. Thank you!