In this page you will find the command line database tutorials, I will show you how to create a database, a user, on the command line.
Then if you lose your password, you will see how to reset it.
Command line database
Forgotten MySql password
If you lose your Root password, here is the procedure to follow.