How to edit user_id on the comment edit screen

You can take reference from below code. It will provide an option to update user id of comment (https://prnt.sc/s57q4f). paste below code in active theme’s functions.php file.I have tested and it is working for me. let me know if it works for you.

# comment user id update metabox
function action_add_meta_boxes_comment( $comment ) {
    ?>
    <div id="commnet-user-id" class="stuffbox">
        <div class="inside">
        <h2 class="edit-comment-userid"><?php _e( 'Commment User ID' ); ?></h2>
        <fieldset>
        <legend class="screen-reader-text"><?php _e( 'Comment User ID' ); ?></legend>
        <table class="form-table editcomment" role="presentation">
        <tbody>
        <tr>
            <td class="first"><label for="name"><?php _e( 'User ID' ); ?></label></td>
            <td><input type="text" name="newcomment_userid" size="30" value="<?php echo esc_attr( $comment->user_id ); ?>" id="user_id" /></td>
        </tr>

        </tbody>
        </table>
        </fieldset>
        </div>
        </div>
    <?php
};          
// add the action 
add_action( 'add_meta_boxes_comment', 'action_add_meta_boxes_comment', 10, 1 ); 

add_filter( 'comment_edit_redirect',  'save_edit_comment_data', 10, 2 );
function save_edit_comment_data( $location, $comment_id )
{
    $_POST['user_id'] = (int) $_POST['newcomment_userid'];
    wp_update_comment( $_POST );
    return $location;
}

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