Set meta_key and meta_value for all registered user in wordpress using sql query [closed]

Add this code in functions.php. visit your site you, it will automatic add/update all user meta value. After executing this code just comment out or remove this code.

$args = array(
  'fields'       => 'all',
 );
$blogusers = get_users( $args);
foreach($blogusers as $key => $user){
  update_user_meta( $user->ID, 'is_activated', 1 );
}

OR
you can also do this using $wpdb

global $wpdb;
$users = $wpdb->get_results( "SELECT ID FROM $wpdb->users" );
if( $users ) {
  foreach ( $users as $user ) {
    update_user_meta( $user->ID, 'is_activated', 1 );
  }
}

check PHPMyAdmin you will find every user meta_key=is_activated
is set to 1.