{"id":2648,"date":"2021-06-04T14:38:18","date_gmt":"2021-06-04T12:38:18","guid":{"rendered":"https:\/\/mainetcare.de\/?post_type=techdoc&#038;p=2648"},"modified":"2026-07-14T11:35:16","modified_gmt":"2026-07-14T09:35:16","slug":"wp-cli-error-error-establishing-a-database-connection","status":"publish","type":"gartenschuppen","link":"https:\/\/mainetcare.de\/en\/gartenschuppen\/wp-cli-error-error-establishing-a-database-connection\/","title":{"rendered":"WP CLI Error: Error establishing a database connection."},"content":{"rendered":"<p>Appearance: Submitting commands via WP CLI, but WordPress in the browser works. This error often occurs when the WP CL interpreter cannot interpret the database connection in wp-config.php correctly.<\/p>\n<blockquote><p>Solution:<\/p>\n<p>In 99% of all cases, change the value of the constant DB_HOST from \"localhost\" to \"127.0.0.1\".<\/p><\/blockquote>\n<p>Background: \"localhost\" is not a fixed IP address. The system now has several options for interpretation. In some cases, \"localhost\" is interpreted as an alias for a socket connection instead of the TCP network protocol. The socket connection does not work via the command line.<\/p>","protected":false},"featured_media":0,"template":"","meta":{"_acf_changed":false},"class_list":["post-2648","gartenschuppen","type-gartenschuppen","status-publish","hentry"],"acf":[],"_links":{"self":[{"href":"https:\/\/mainetcare.de\/en\/wp-json\/wp\/v2\/gartenschuppen\/2648","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mainetcare.de\/en\/wp-json\/wp\/v2\/gartenschuppen"}],"about":[{"href":"https:\/\/mainetcare.de\/en\/wp-json\/wp\/v2\/types\/gartenschuppen"}],"wp:attachment":[{"href":"https:\/\/mainetcare.de\/en\/wp-json\/wp\/v2\/media?parent=2648"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}