Install the memory card into a computer.
Edit cmdline.txt. Append "init=/bin/sh" to the parameter string.
Save the file, then reinsert the mem card into the Pi and boot it.
Remount the file system as read/write: mount -o remount, rw /
Change the password: passwd pi
Bring the the Pi up to normal run level: sync; exec /sbin/init
Test password.
Shut down, remove the mem card. Use the other computer to edit cmdline.txt to remove the init cmd.