In DB2, you can change a user's password during connection using the syntax: CONNECT TO database USER username USING old_password NEW new_password CONFIRM new_password. This verifies and updates the password in the operating system or external security manager.