How to add custom taxonomy terms to posts in bulk

First get all the posts with the tag “LA Lakers”. Then add “LA Lakers” as the new taxonomy terms for those posts.

//Get all post with the tag LA Lakers
$query = new WP_Query( 'tag=LA Lakers' );

//Loop through all the posts
while( $query->have_posts() ) {
    $query->the_post();
    //Set "LA Lakers" as taxonomy terms for these posts
    wp_set_object_terms($query->post->ID, array("LA Lakers"), "Teams", true);
}
wp_reset_postdata();

I believe you get the idea. See wp_set_object_terms() to get more idea about the parameters.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)