{"id":4949,"date":"2018-02-18T15:09:11","date_gmt":"2018-02-18T15:09:11","guid":{"rendered":"https:\/\/musilda.cz\/?p=4949"},"modified":"2018-02-18T15:09:11","modified_gmt":"2018-02-18T15:09:11","slug":"jak-opravit-chybu-error-establishing-a-database-connection-ve-wordpressu","status":"publish","type":"post","link":"https:\/\/affinite.io\/cs\/jak-opravit-chybu-error-establishing-a-database-connection-ve-wordpressu\/","title":{"rendered":"Jak opravit chybu „Error Establishing a Database Connection“ ve WordPressu"},"content":{"rendered":"
V\u011bt\u0161ina vlastn\u00edk\u016f webov\u00fdch str\u00e1nek se s t\u00edm setkala – web se nena\u010dte. V prohl\u00ed\u017ee\u010di jen b\u00edl\u00e1 str\u00e1nka s informac\u00ed „Error Establishing a Database Connection<\/strong>„. Z\u00e1kazn\u00edci p\u00ed\u0161i e-maily, nebo volaj\u00ed, \u017ee si nemohou nic objednat, proto\u017ee nic nefunguje.<\/p>\n Tato chyba se d\u00e1 pom\u011brn\u011b lehce vy\u0159e\u0161it, bohu\u017eel, d\u016fvod\u016f, pro\u010d se objevila, m\u016f\u017ee b\u00fdt v\u00edce.<\/p>\n <\/p>\n A\u0165 ji\u017e web web hostujete, nebo jej m\u00e1te um\u00edst\u011bn na vlastn\u00edm serveru, m\u016f\u017ee doj\u00edt k tomu, \u017ee je stroj p\u0159et\u00ed\u017een. St\u00e1v\u00e1 se to p\u0159edev\u0161\u00edm u slab\u0161\u00edch hosting\u016f, kdy se zvedne n\u00e1v\u0161t\u011bvost a server za\u010dne ignorovat po\u017eadavky o p\u0159ipojen\u00ed do datab\u00e1ze, kter\u00e9 nezvl\u00e1d\u00e1 obslou\u017eit.<\/p>\n \u010casto to m\u016f\u017eete vid\u011bt u web\u016f, kter\u00e9 spust\u00ed mas\u00edvn\u00ed reklamu a za chv\u00edli prost\u011b spadnou.<\/p>\n \u0158e\u0161en\u00ed je jednoduch\u00e9 – nav\u00fd\u0161it tarif hostingu, nebo zaplatit v\u00fdkon\u011bj\u0161\u00ed server.<\/strong><\/p>\n Jak ale poznat, \u017ee se jedn\u00e1 pr\u00e1v\u011b o tento p\u0159\u00edpad?<\/p>\n Url pro p\u0159ihl\u00e1\u0161en\u00ed do phpMyAdmin na va\u0161em serveru v\u00e1m poskytne hosting a pokud se v\u00e1m formul\u00e1\u0159 na obr\u00e1zku ani nezobraz\u00ed, v\u00edte, \u017ee se nejedn\u00e1 o chybu na va\u0161i stran\u011b, ale je to probl\u00e9m serveru.<\/p>\n Kdy\u017e se dostanete do phpMyAdmin, je jasn\u00e9, \u017ee probl\u00e9m mus\u00ed b\u00fdt jinde.<\/p>\n Dal\u0161\u00ed mo\u017enost\u00ed je po\u0161kozen\u00ed tabulek v datab\u00e1zi. A tento probl\u00e9m se projevuje tak, \u017ee i kdy\u017e na ve\u0159ejn\u00e9 \u010d\u00e1sti vid\u00edte chybu\u00a0„Error Establishing a Database Connection<\/strong>„, do administrace se bez probl\u00e9m\u016f p\u0159ihl\u00e1s\u00edte.<\/p>\n WordPress m\u00e1 super mechanizmus, kter\u00fd um\u00ed „opravit“ datab\u00e1zi automaticky. Mus\u00edte mu to ale „\u0159\u00edct“, co\u017e znamen\u00e1 \u00fapravu souboru wp-config.php.<\/p>\n Ten najdete v ko\u0159enov\u00e9 slo\u017ece WordPress instalace:<\/p>\n Pomoc\u00ed FTP klienta si jej st\u00e1hnete do po\u010d\u00edta\u010de a otev\u0159ete pomoc\u00ed editoru. Pou\u017e\u00edt m\u016f\u017eete nap\u0159\u00edklad Sublime<\/a>.<\/p>\n V souboru najd\u011bte \u0159\u00e1dek s koment\u00e1\u0159em „\/* That’s all, stop editing! Happy blogging. *\/“ a p\u0159ed n\u011bj vlo\u017ete z\u00e1pis:<\/p>\n T\u00edm jste povolili WordPressu automaticky opravit tabulky, kter\u00e9 pot\u0159ebuje k fungov\u00e1n\u00ed a kter\u00e9 mohou b\u00fdt po\u0161kozen\u00e9.<\/p>\n Po aktualizaci souboru obnovte str\u00e1nku a m\u011bli by jste vid\u011bt toto upozorn\u011bn\u00ed:<\/p>\n Oprava datab\u00e1ze se v\u00e1m zobraz\u00ed, i kdy\u017e nejste p\u0159ihl\u00e1\u0161eni, proto by jste m\u011bli definici povolen\u00ed opravy ze souboru wp-config.php, po oprav\u011b odstranit, aby se toto hl\u00e1\u0161en\u00ed nezobrazilo i n\u00e1v\u0161t\u011bvn\u00edk\u016fm.<\/p>\n V p\u0159\u00edpad\u011b, \u017ee v\u00e1m tento postup nepomohl, nebo se jev\u00ed, \u017ee server funguje a vy se nem\u016f\u017eete dostat ani do administrace, p\u016fjde o probl\u00e9m s p\u0159\u00edstupov\u00fdmi \u00fadaji do datab\u00e1ze.<\/p>\n P\u0159i ka\u017ed\u00e9 instalaci WordPressu, zad\u00e1v\u00e1te n\u00e1sleduj\u00edc\u00ed \u00fadaje:<\/p>\n Tyto \u00fadaje slou\u017e\u00ed k tomu, aby mohl WordPress p\u0159i instalaci vytvo\u0159it tabulky, do kter\u00fdch ukl\u00e1d\u00e1 data. A v p\u0159\u00edpad\u011b, \u017ee tyto \u00fadaje jsou nespr\u00e1vn\u00e9, p\u0159ipojen\u00ed k datab\u00e1zi sel\u017ee.<\/p>\n Co\u017e je ona chyba\u00a0„Error Establishing a Database Connection<\/strong>„.<\/p>\n P\u0159i oprav\u011b tohoto probl\u00e9mu budeme postupovat podobn\u011b, jako v p\u0159edchoz\u00edm p\u0159\u00edpad\u011b, kdy jsme upravovali soubor wp-config.php. Ten otev\u0159eme a m\u00edsto jeho dopl\u0148ov\u00e1n\u00ed, najdeme v souboru tyto \u0159\u00e1dky:<\/p>\n Tyto \u00fadaje mus\u00edte zkontrolovat a pokud se li\u0161\u00ed, tak je opravte. T\u00edm bude v\u0161e vy\u0159e\u0161eno.<\/p>\n Ze v\u0161ech t\u0159\u00ed p\u0159\u00edpad\u016f, kter\u00e9 jsme si v \u010dl\u00e1nku popsali, je p\u0159et\u00ed\u017een\u00ed serveru nej\u010dast\u011bj\u0161\u00ed, ale zase nem\u00e1 dlouhodob\u011bj\u0161\u00edho trv\u00e1n\u00ed. Naproti tomu, \u0161patn\u00e9 \u00fadaje ve wp-config jsou v\u011bt\u0161inou zp\u016fsobeny nepozornost\u00ed p\u0159i zad\u00e1v\u00e1n\u00ed, nebo p\u0159eps\u00e1n\u00edm \u0161patn\u00e9ho souboru na FTP<\/p>\n Nejste schopni vy\u0159e\u0161it probl\u00e9m s va\u0161\u00ed str\u00e1nkou? Napi\u0161te do koment\u00e1\u0159\u016f.<\/p>\n","protected":false},"excerpt":{"rendered":" V\u011bt\u0161ina vlastn\u00edk\u016f webov\u00fdch str\u00e1nek se s t\u00edm setkala – web se nena\u010dte. V prohl\u00ed\u017ee\u010di jen b\u00edl\u00e1 str\u00e1nka s informac\u00ed „Error Establishing a Database Connection„. Z\u00e1kazn\u00edci p\u00ed\u0161i e-maily, nebo volaj\u00ed, \u017ee si nemohou nic objednat, proto\u017ee nic nefunguje. Tato chyba se d\u00e1 pom\u011brn\u011b lehce vy\u0159e\u0161it, bohu\u017eel, d\u016fvod\u016f, pro\u010d se objevila, m\u016f\u017ee b\u00fdt v\u00edce. Mo\u017en\u00e9 p\u0159\u00ed\u010diny chyby<\/p>\n","protected":false},"author":1,"featured_media":4959,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[53,30],"tags":[131,482],"class_list":["post-4949","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-reseni-problemu","category-wordpress","tag-error-establishing-a-database-connection","tag-wordpress-chyby"],"_links":{"self":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/posts\/4949"}],"collection":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/comments?post=4949"}],"version-history":[{"count":0,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/posts\/4949\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/media\/4959"}],"wp:attachment":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/media?parent=4949"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/categories?post=4949"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/tags?post=4949"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}Mo\u017en\u00e9 p\u0159\u00ed\u010diny chyby Establishing a Database Connection<\/h2>\n
\n
P\u0159et\u00ed\u017een\u00ed serveru na kter\u00e9m je web um\u00edst\u011bn<\/h2>\n
\n
<\/a><\/p>\n
Po\u0161kozen\u00ed tabulek ve WordPress datab\u00e1zi<\/h2>\n
<\/a><\/p>\n
define(<\/code>
'WP_ALLOW_REPAIR'<\/code>
, true);<\/code><\/p><\/blockquote>\n
<\/a><\/p>\n
\u0160patn\u011b zadan\u00e9 \u00fadaje pro p\u0159ipojen\u00ed k WordPress datab\u00e1zi<\/h2>\n
\n
<\/a><\/p>\n
Dal\u0161\u00ed tipy na \u0159e\u0161en\u00ed probl\u00e9m\u016f ve WordPressu<\/h3>\n
\n