UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root';
The UPDATE and FLUSH statements each must be written on a single line. The UPDATE statement resets the password for all existing root accounts, and the FLUSH statement tells the server to reload the grant tables into memory.
Save the file. For this example, the file will be named /home/mysql/myl-init. Now you can start MySQL Service using 2 ways.
a. Start the MySQL server with the special --init-file option:
shell> mysqld_safe --init-file=/home/mysql/myl-init &
The server executes the contents of the file named by the --init-file option at startup, changing each root account password.
Now login to MySQL instance and start using it