- stop the mysqld daemon
sudo systemctl stop mysql.service # it depends on your distro - start mysql server skipping grant tables
mysqld_safe --skip-grant-tables & - start mysql client
sudo mysql - run the following sql commands
UPDATE mysql.user SET Password=PASSWORD('NEW-PASSWORD') WHERE User='root'; FLUSH PRIVILEGES;