I hadn't used my pi for a while and when I did I found that I had changed the pi user password from the predfined 'raspberry' one. I did a bit of searching and found a method that work so thought i'd share.
Remove the SD card from your pi and insert into a card read attached to a windows machine.
After being detected a new drive should show up under My Computer called 'boot'
Open this drive and open the file cmdline.txt
This is a single line file and should look somethinig like this
dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p3 rootfstype=ext4 rootwait
Now what you need to do is add init=/bin/sh to the end of it so it looks like this
dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p3 rootfstype=ext4 rootwait init=/bin/sh
Save and close and reinsert the card into your pi. Now you'll need a KVM attached to your pi for the next bit, power up the pi and you'll notice early on in the boot process it stops and returns a bash prompt character #
From here enter the following
mount -o remount,rw /
passwd pi
(enter a new password)
sync
exec /sbin/init
You can also change the root user password at the same time if you have enabled that user, just use passwd root
After executing the final command your pi will boot normally and you will be able to login using the credentials you set. The final stage is to open /boot/cmdline.txt file and remove init=/bin/sh form the end, on your next reboot the pi will go through the boot process normally.