Simple sql for bulk password change

Changing the password for user 1 is as follows:

UPDATE `mydb`.`wp_users` 
   SET `user_pass` = MD5( 'password' ) 
 WHERE `wp_users`.`ID` = 1;

Now I have a text file with this format:

user30 pass30
...
user2 pass2
user1 pass1

How can I change the password for all these users without doing it manually? Maybe some sql command that can import it from this file? Or some other method? I am using phpmyadmin, maybe I can somehow import this data into these specific fields?

I only want to import a password of 5 or more.

+3
source share
1 answer

SQL, . , ( "password_changes" ) " " "_", -

UPDATE wp_users, password_changes
SET wp_users.user_pass = md5(password_changes.new_password)
WHERE wp_users.user_login = password_changes.username

, (, , password_changes). , , 1-4 , AND wp_users.ID >= 5 .

+4

Source: https://habr.com/ru/post/1763197/


All Articles