Pokud spravujete wordpres weby a občas uživatel zapomene heslo a není funční odelání reset hesla skrze formulář.
Stačí se připojit do konzole jako admin a zadat
mysql -u root -p / tímto se přihlásite jako admin k db /heslo byste měli mít někde napsané..
pak se připojíte do databáze, najdete v wp-config.php
čili bud nano /var/www/vasweb/public/wp-config.php nebo příkazem CAT
něco jako define( ‚DB_NAME‘, „databaze1“ );
pak se připojíme k databázi
use database1
pokud nevíme v které tabulce jsou uživatelé hledáme něco kde je slovo users
tímto příkazem vylistujeme všechny tabulky
SHOW TABLES;
+———————–+
| Tables_in_moje_wp_db |
+———————–+
| wp_users |
| wp_posts |
| wp_options |
| wp_comments |
| wp_usermeta |
+———————–+
pak je důležité kde v jaké tabulce jsou uzivatele může být wp_users nebo u Wordfence např Ufv_users atd
toto zjistíte po připojení k databázi
případně pokud už víme že se jedná např o Ufv_users můžeme zjistit všechny uživatele
SELECT * FROM Ufv_users;
+—-+————+——————-+
| ID | user_login | user_email |
+—-+————+——————-+
| 1 | admin | admin@web.cz |
| 2 | editor | editor@web.cz |
+—-+————+——————-+
a pak zadáme: UPDATE Ufv_users SET user_pass = MD5(‚N3jak3sl0z1te_h3sl0‘) WHERE user_login = ‚admin‘;
Obecně radši nepoužívejte uživatele admin a případně doporučuji doplněk Wordfence se zapnutou notifikací
—————————————————————
ENGLISH version
If you manage WordPress websites and sometimes a user forgets their password and sending a password reset via the form is not functional.
Just connect to the console as admin and enter
mysql -u root -p / this will log you in as admin to the db / you should have the password written somewhere..
then connect to the database, you will find it in wp-config.php
either nano /var/www/vasweb/public/wp-config.php or with the CAT command
something like define( ‚DB_NAME‘, „databaze1“ );
then we connect to the database
use database1
if we don’t know in which table the users are, we look for something where the word users is
this command lists all tables
SHOW TABLES;
+——————-+
| Tables_in_my_wp_db |
+——————-+
| wp_users |
| wp_posts |
| wp_options |
| wp_comments |
| wp_usermeta |
+———————–+
then it is important where in which table the users are, it can be wp_users or in Wordfence for example Ufv_users etc.
you will find this out after connecting to the database
or if we already know that it is for example Ufv_users we can find out all users
SELECT * FROM Ufv_users;
+—-+————+——————+
| ID | user_login | user_email |
+—-+————+——————+
| 1 | admin | admin@web.cz |
| 2 | editor | editor@web.cz |
+—-+————+——————+
and then we enter: UPDATE Ufv_users SET user_pass = MD5(‚pAssW0rd_n04Asy‘) WHERE user_login = ‚admin‘;
In general, I prefer not to use the admin user and I recommend the Wordfence add-on with notifications enabled