Blog članak

How to Reset a WordPress Password with MySQL CLI

Reset a WordPress admin password from the MySQL command line when you cannot access wp-admin.

Sam tekst članka trenutačno je i dalje na engleskom, ali hrvatska navigacija, arhiva i povezani sadržaji ostaju dostupni.

See the name of the database used by WP. You can find the database name in the wp-config.php file or you can use the command

grep DB_NAME wp-config.php

We are interested in this line

define( 'DB_NAME', 'wpdatabase' );

Once we find out the name of the database we need to connect to it using the command

mysql -u root -p wpdatabase

Now we need to find the user using a command similar to this, customize as needed

SELECT ID, user_login, user_pass, user_email FROM wp_users;

when we find the user it is easiest to select it using the ID, most often the administrator ID is 1 because it is the first user-created, and the command to enter a new password is as follows

UPDATE wp_users SET user_pass = MD5('my-new-password-here') WHERE ID = 1;
quit;

That’s it, try logging in to WP administration.

Povezane usluge

Ove su usluge usklađene s temom članka i daju čišći prijelaz od edukativnog sadržaja do konkretne implementacije.

Nastavite čitati

Prvo po zajedničkim kategorijama, a zatim po najjačem preklapanju u tagovima.