Automatically update slug with latest title within custom post type [duplicate]

With the help and direction of bosco I was able to get it right!
The code below is a modified version of the answer found here.

function my_enqueue_music_features( $hook_suffix ){


$posts = get_posts( array (  
    'numberposts' => -1, //this will get all
    'post_type'   => 'music'
) );

foreach ( $posts as $post ) {
    // check the slug and run an update if necessary 
    $new_slug = sanitize_title( $post->post_title );
    if ( $post->post_name != $new_slug )
    {
        wp_update_post(
            array (
                'ID'        => $post->ID,
                'post_name' => $new_slug
            )
        );
    }
}

}
add_action( 'admin_enqueue_scripts', 'my_enqueue_music_features');

The only thing I added was basically this:
'post_type' => 'music'. Change “music” to your custom post type.

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