I hope this will never happen to you. But if you ever forgot your root password, then follow these steps to reset it. I cannot guarantee this method will work for all versions of osx, but it worked for me on my mac mini 1.5 GHz model at least.
Hold Apple+S when booting, you will then enter the single user mode
Run “/sbin/mount -uw /”. If you read through all the bootup comments it’s somewhere in there. It basically enables you to make changes to your hard drive.
Run “passwd”. Then put in your new root password twice.
Run “exit”. The reboot process should begin. You are done!