how to serialize() mysql update data

You should not use raw SQL to modify roles and capabilities, it is very bad practice, and unnecessary.

Instead, use the roles API, e.g.

$role = get_role( 'subscriber' );
$role->add_cap( 'read' ); 

Or to add it to a specific user:

$user = new WP_User( $user_id );
$user->add_cap( 'read' );

Likewise you can remove a capability from a role:

$role = get_role( 'subscriber' );
$role->remove_cap( 'read' ); 

error code: 523