Stop the mysql server:

kill `cat /var/run/mysqld/`

Now, execute:

# mysqld_safe --skip-grant-tables --skip-networking &
[1] 7855
[email protected]:~# 131114 14:35:02 mysqld_safe Logging to syslog.
131114 14:35:02 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql

Now you can connect to mysql as root without a password:

# mysql --user=root mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.31-0+wheezy1 (Debian)

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.


Now, execute the following commands from mysql shell to reset password for root:

mysql> UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root';