How to reset lost root password for MySQL
Here are simple manual about resetting forgotten root password on MySQL. This actions cannot be done without root access to computer/server, so you will need root password for this action. On this text we will reset password on Ubuntu 14.04 server.
# Stop MySQL server. While it's stopped all sites which are connected to dataase will be inaccessible # If you're use Ubuntu run sudo /etc/init.d/mysql stop # If you use CentOS run sudo /etc/init.d/mysqld stop # Go into MySQL safe mode sudo mysqld_safe --skip-grant-tables & mysql -uroot use mysql; update user set password=PASSWORD("yournewpassword") where User='root'; flush privileges; quit; # (re)Start MySQL server # Ubuntu sudo /etc/init.d/mysql restart # CentOS sudo /etc/init.d/mysqld start # Try to login to MySQL as root mysql -u root -p