How do I fix the error in the Gutenberg editor "Update failed" or "Publishing failed"?

If you receive the error message "Update failed" or "Publish failed" when saving a post in the WordPress Gutenberg editor, this could be due to an incorrect database configuration. The solution is as follows...