Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPB Cup
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

Wie man das WordPress Admin-Passwort auf Localhost zurücksetzt

Wenn Sie von Ihrer lokalen WordPress Website ausgesperrt werden, kann Ihre Arbeit zum Erliegen kommen. Uns ist das beim Testen von Themes oder beim Einrichten von Kundenprojekten in der lokalen Umgebung schon passiert.

Das Frustrierende daran ist, dass E-Mails zum Zurücksetzen von Passwörtern bei Localhost-Konfigurationen nicht funktionieren. Selbst wenn Sie also auf “Passwort vergessen?” klicken, erscheint nichts in Ihrem Posteingang.

Zum Glück gibt es einfache Methoden, um Ihr WordPress-Administrator-Passwort zurückzusetzen, ohne auf E-Mails zugreifen zu müssen. Wir haben diese Methoden unzählige Male verwendet, um wieder auf unsere lokalen Websites zu gelangen.

In diesem Tutorial zeigen wir Ihnen, wie Sie Ihr WordPress-Administrator-Passwort auf Localhost mit phpMyAdmin oder WP-CLI zurücksetzen können – je nachdem, was Ihnen besser gefällt.

Resetting the admin password in WordPress on localhost

Warum das Zurücksetzen des Passworts auf Localhost nicht funktioniert

Wenn wir “localhost” sagen, meinen wir einen lokalen Server – normalerweise Ihren Computer. Es handelt sich um einen privaten Bereich, in dem Sie eine WordPress Website erstellen und testen können, bevor Sie live gehen.

Wir nutzen localhost oft, um mit neuen Plugins zu experimentieren, Designänderungen vorzunehmen oder einfach zu lernen, wie WordPress funktioniert. Es ist ein sicherer Weg, Dinge zu verändern, ohne sich Sorgen zu machen.

Wenn Sie es noch nicht ausprobiert haben, können diese Anleitungen Ihnen den Einstieg erleichtern:

Jetzt kommt der Teil, der für Anfänger verwirrend sein kann. Wenn Sie Ihr Administrator-Passwort auf einer lokalen Website vergessen haben, hilft Ihnen der normale Link “Passwort vergessen” nicht weiter.

Das liegt daran, dass WordPress normalerweise eine E-Mail zum Zurücksetzen des Kennworts versendet, aber Localhost-Einrichtungen können keine E-Mails versenden, es sei denn, Sie haben das manuell eingerichtet. Und das haben die meisten Menschen standardmäßig nicht.

Zum Glück brauchen Sie keine E-Mail, um sich wieder anzumelden. Wir zeigen Ihnen zwei einfache Möglichkeiten, wie Sie Ihr Passwort auf localhost zurücksetzen können, selbst wenn Sie komplett ausgesperrt sind.

Methode 1: WordPress Admin-Passwort auf Localhost mit phpMyAdmin zurücksetzen

Wenn Sie Werkzeuge wie XAMPP, WAMP oder MAMP verwenden, dann sollte phpMyAdmin bereits installiert sein. Wir haben es schon oft benutzt, um Dinge direkt in der Datenbank zu ändern – auch um Passwörter zurückzusetzen.

phpMyAdmin bietet Ihnen eine visuelle Schnittstelle zur Verwaltung Ihrer WordPress-Datenbank. Es klingt kompliziert, aber wenn man den Dreh erst einmal raus hat, ist es ziemlich einfach.

Hinweis: Wenn Sie LocalWP verwenden, sehen Sie stattdessen ein Werkzeug namens Adminer. Es funktioniert genau wie phpMyAdmin, so dass Sie diese Schritte trotzdem einfach durchführen können.

Adminer the phyMyAdmin alternative in LocalWP

Öffnen Sie zunächst Ihren Browser und rufen Sie diese Adresse auf:

http://localhost/phpmyadmin/

Sie werden möglicherweise aufgefordert, sich anzumelden. In den meisten Fällen ist der Benutzername root und das Passwortfeld bleibt leer.

Sobald Sie in phpMyAdmin sind, suchen Sie den Namen Ihrer WordPress-Datenbank in der Seitenleiste und klicken Sie darauf.

Open your database in phpMyAdmin

Es wird eine Liste der Tabellen in dieser Datenbank angezeigt. Suchen Sie die Tabelle, die auf _users endet, und klicken Sie auf den Link Durchsuchen neben der Tabelle.

Hinweis: Die meisten Websites von WordPress verwenden wp_ als Präfix, aber es könnte anders sein, wenn Sie es während der Einrichtung geändert haben.

Open users table in WordPress database

Sie sehen nun eine Liste der Benutzer auf Ihrer Website. Suchen Sie die Zeile mit dem Benutzernamen des Administrators und klicken Sie auf den Link Bearbeiten daneben.

Edit user in WordPress database

Es öffnet sich ein Formular, das alle in der Datenbank gespeicherten Benutzerdaten anzeigt. Blättern Sie nach unten, bis Sie das Feld user_pass finden.

Geben Sie in der Spalte Wert Ihr neues Kennwort ein. Wählen Sie dann in der Spalte Funktion die Option MD5 aus der Dropdown-Liste.

Add new user password

Dieser Schritt ist wichtig – WordPress speichert Passwörter verschlüsselt, und MD5 hilft, das Format zu erkennen.

Klicken Sie unten auf den Button Go, um Ihre Änderungen zu speichern.

Save database changes

Das war’s! Sie können sich jetzt bei Ihrer lokalen WordPress Website mit dem neuen Passwort anmelden, das Sie gerade festgelegt haben.

Methode 2: Zurücksetzen des Passworts über die Datei Functions.php

Wenn Sie keinen Zugang zu phpMyAdmin haben oder eine andere Vorgehensweise bevorzugen, können Sie Ihr WordPress-Administrator-Passwort zurücksetzen, indem Sie die Datei functions.php Ihres Themes bearbeiten. Diese Methode ist einfach und kann schnell durchgeführt werden.

Schritt 1: Zugriff auf die Datei Functions.php des Themes

Zunächst müssen Sie die Datei functions.php für Ihr aktives Theme finden. Wechseln Sie dazu in das Stammverzeichnis Ihrer WordPress-Installation auf Ihrem lokalen Rechner.

Je nachdem, welche Software Sie verwenden, kann die Position des Stammverzeichnisses unterschiedlich sein. Wenn Sie z. B. Local verwenden, befindet sich Ihre Website an folgender Position:

C:\Benutzer\Ihr-Benutzername\Lokale Websites\Ihr-Benutzername\Publik\

Wechseln Sie dann in den Ordner /wp-content/themes/. Darin finden Sie einen Ordner, der nach Ihrem aktiven Theme benannt ist.

Locating your theme folder

Suchen Sie im Ordner Ihres aktiven Themes nach einer Datei namens functions.php und öffnen Sie sie in einem Texteditor wie Notepad oder TextEdit.

Schritt 2: Hinzufügen des Codes zum Zurücksetzen des Passworts

Am Ende der Datei functions.php müssen Sie den folgenden Code einfügen:

function reset_admin_password() {
    $user_id = 1; // ID of the admin user
    $new_password = 'newpassword123'; // Your new password
    wp_set_password($new_password, $user_id);
}
add_action('init', 'reset_admin_password');

Vergessen Sie nicht, “newpassword123” durch ein stärkeres Passwort zu ersetzen, das Sie verwenden möchten.

Mit diesem Code wird ein neues Kennwort für den Benutzer admin mit der ID 1 festgelegt. Wenn Sie die Benutzer-ID nicht kennen, aber die E-Mail-Adresse des Administrators wissen, können Sie stattdessen dieses Codeschnipsel verwenden:

function reset_admin_password_by_email() {
    $user_email = 'admin@example.com'; // Admin user's email address
    $user = get_user_by('email', $user_email);
    if ($user) {
        $new_password = 'newpassword123'; // Your new password
        wp_set_password($new_password, $user->ID);
    }
}
add_action('init', 'reset_admin_password_by_email');

Dieser Code setzt ein neues Passwort(newpassword123) für den Benutzer admin, der mit der angegebenen E-Mail-Adresse verbunden ist.

Nachdem Sie den Code hinzugefügt haben, speichern Sie die Datei functions.php und aktualisieren Sie die WordPress Website auf Ihrem lokalen Host in Ihrem Browser. Sie sollten nun in der Lage sein, sich mit dem neuen Passwort anzumelden.

Schritt 4: Entfernen des Codes

Nachdem Sie sich erfolgreich angemeldet haben, ist es wichtig, den Codeschnipsel aus der Datei functions.php zu entfernen, um mögliche Sicherheitsrisiken zu vermeiden.

Öffnen Sie einfach die Datei functions.php und löschen Sie den Code, den Sie zuvor hinzugefügt haben. Vergessen Sie nicht, Ihre Änderungen zu speichern.

Bonus Ressourcen:

Im Folgenden finden Sie weitere Tipps und Anleitungen zur Verwaltung von Passwörtern und Administratorkonten in WordPress:

Wir hoffen, dass dieser Artikel Ihnen geholfen hat, Ihr WordPress-Administrator-Passwort auf einem lokalen Server zurückzusetzen. Vielleicht interessiert Sie auch unser Tutorial zum Erstellen einer temporären Anmeldung für WordPress oder unsere Anleitung zum Hinzufügen einer Google-Anmeldung mit einem Klick in WordPress.

Wenn Ihnen dieser Artikel gefallen hat, dann abonnieren Sie bitte unseren YouTube-Kanal für WordPress-Videotutorials. Sie können uns auch auf Twitter und Facebook finden.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us. Here's our editorial process.

Avatar

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit - a collection of WordPress related products and resources that every professional should have!

Reader Interactions

63 KommentareLeave a Reply

  1. Hafiz Muhammad Ansar

    Very nice blog for WordPress help. I recommend for beginners to use this platform. Thankful!

    • WPBeginner Support

      Glad you found our article helpful!

      Admin

    • WPBeginner Support

      Glad our guide was helpful!

      Admin

  2. Nidhi Gupta

    it’s really helpful, thankyou so much

    • WPBeginner Support

      Glad our guide was helpful!

      Admin

  3. Habu

    Omg you save my life !!! THANK YOU VERY MUCHH !!!

  4. Jahir

    I can not log in now same process…any updates?

    • WPBeginner Support

      The most common issue would be if you did not set the function to MD5 or click go to apply the changes, you would want to ensure you have done that correctly.

      Admin

  5. Kamondo

    Wonderful! problem solved. Very Simple steps but powerful.

    • WPBeginner Support

      Glad our guide was helpful :)

      Admin

  6. Joe

    I’m encoutering this problem now after installing the 2nd WordPress on MAMP. This article is very to the point and I’ll try it tomorrow!

    • WPBeginner Support

      We hope the guide helps :)

      Admin

  7. Gerron

    Solid solid info right here, thanks a lot, really helped, so simple

    • WPBeginner Support

      Glad our guide was helpful :)

      Admin

  8. Odineks

    Thank you so much. I always find solutions to every of my WP problems here.
    I kept having problems with the login page on the frontend not recognizing my new password, I didn’t realize there is a function to pass that message to myPHPadmin.

    • WPBeginner Support

      Glad our guide was helpful :)

      Admin

  9. naved ahmed

    Thanks a lot. Finally problem solved within a minute.

    • WPBeginner Support

      Glad our guide was helpful :)

      Admin

  10. Mohsin

    I just love this
    Love the way you write every thing

    • WPBeginner Support

      Thank you, glad you like our content :)

      Admin

  11. Jen

    I tried this and while I was in there also attempted to change my username, which I realize was probably my mistake… but now I can’t log in at all. Is there a way to undo what I’ve done?

    • WPBeginner Support

      You would need to follow the steps in the article and that would bring you back to where you could edit, you should also be able to use your email as an alternative

      Admin

  12. Justina

    Your Blog is always so full of rich articles. Thanks so much. was stuck for a while because I skip the MD5 option. You are a lifesaver.

    • WPBeginner Support

      Glad our guide could be helpful :)

      Admin

  13. Sarah

    Thank you SO MUCH for this! You saved me so many more hours of tinkering with trying to figure out how to log in!!

    • WPBeginner Support

      Glad we were able to help :)

      Admin

  14. David

    Thank you ever so much! Normally, I keep this stuff handy; but in this case, I did could not find where I wrote the information down.

    You saved a total re-work of a site I was planning.

    • WPBeginner Support

      Glad our guide could be helpful :)

      Admin

  15. adeel kamran

    You saved me, I had a lot of work there.

    • WPBeginner Support

      Glad our guide could help :)

      Admin

  16. lokesh n

    thank you it’s really working thank you

    • WPBeginner Support

      You’re welcome glad our article was helpful :)

      Admin

  17. Vivek

    Hi,
    When I reset My password through link then what fileds affected in Database and in which table.

    Kindly share this information i am waiting for your response.

  18. Adnan Khan

    After half an hour of search i just found my help from this site, which solves my problem in no time,
    thanks a lot
    keep it up guys

    • WPBeginner Support

      You’re welcome, glad our guides can be helpful :)

      Admin

  19. Tenasu Mensah

    thanks a lot, kudos to you guys keep the good work doing,you guys are doing great job

    • WPBeginner Support

      Glad our guide could help :)

      Admin

  20. Anuj

    It work fine, Thanku so much,

  21. Pádraig

    Really simple and great explanation.

    Many thanks for sharing.

  22. Saranya

    Works Good! Thanks a lot.

  23. Patr

    Hello,
    I type a new password , click continue and it does not keep the password, it shows a long string of numbers and letters. If I use this , still cannot log in. It looks simple on the video but does not work for me. Thank you.
    I looked everywhere on the internet, no solution worling.

    • Jason

      Same problem here. Did you find a solution? Is there any chance of being hacked?

  24. Christian Gochez

    when I click on the Go button this error appears:

    #1881 – Operation not allowed when innodb_forced_recovery > 0

  25. Edward

    Simple and neat! worked thanks

  26. Handel

    I started to just reinstall wordpress, but then decided to do a google search, and there was GOOD OLD RELIABLE WpBeginner.com

    Thanks a million!!

  27. Icholia

    Hello

    THANKS, Wow there is no other place that you can get well explained information like this , i have been suffering but now i just followed your tutorial and it is a game changer i love you guys and i will always learn from you guys once again thanks

  28. CJ

    Thank you! For those who can’t make it work, remember to use the “MD5” function when changing the password. I almost skipped that part and was stuck for a few minutes.

  29. mohamad hossein

    so use full thank you so much

  30. Janet

    I got completely lost on the video so I tried plugging in the URL. Doesn’t work. Still lost.

  31. Ma

    Thanks so much, you saved me from what could have been a very embarrassing situation!

  32. James

    I change the password, username, userlogin and nickname not I cant login. Any advice?

    • suganya

      i can’t able to login .because it’s shows me like email is not registered .so what can i do???

  33. Jac

    Thanks so much for providing this info – I was really stuck!

  34. Gerhard SCHNEIBEL

    Thanks a lot for your help. I am very happy with “wpbeginners”.

  35. Anthony

    Hi…
    I am so thankful for such great information you provide. I have bookmarked your site a while back.
    I have been working on a site in wordpress using xampp on the Apache local server. Just recently, I am not able to login on the admin page. I have managed to create a user name and password that works on about 95% of all sites requiring me to register. I also created a file that lists all my login info for everywhere I need to login, including the WP admin login page, IF I ever forget that info.
    I have read this page (https://www.wpbeginner.com/wp-tutorials/how-to-reset-wordpress-admin-password-on-localhost/) and watched the video, also. The only problem is that when I click on the wp_users in phpMyadmin, I get this error- ‘#1932 – Table ‘bitnami_wordpress.wp_users’ doesn’t exist in engine.’
    Am I reduced to re-installing WordPress, or is there another way around it?
    I have tried restoring my computer (using system restore) to various past restore points, but with no luck. Can you help me with this?
    I would be so thankful!!! I have put months of work into designing a site to launch, and I HAVE exported everything to a file quite a few times using WordPress import plugin (something like that).

    Could you provide a solution?

    Thank you so much…

    Anthony

  36. Kakaire Charles

    Extremely wonderful. Thank you for sharing.

  37. Gaurav

    i tried this but not working

  38. shaikh muneer

    super way to reset admin password thank you for share this

Leave A Reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.