How do I reset my administrative root password in Ubuntu server?

author

Dev

. 0 min read

Follow

Resetting root password in Ubuntu server is very easy, There are two ways to reset your administrative root password or there are two situations.

  1. When you Lost your Ubuntu Server password: When this happen do nothing, just go to your Cloud service provider (like Digitalocean, hetzner, linode, vultr) dashboard, In Digitalocean Select server go Access menu and click on Reset root password. In hetzner select the server and go to Rescue menu then click on Reset root password. You will get the same option in Linode and Vultr too. 
  2. When you Have the password but you want to set your own password: In this you case you don't want to use system generated password. You wanted to change system generated password to your own. Then just login to your server Terminal and follow the bellow steps.
root@ubuntu:~# passwd oldpassword

Enter new UNIX password:

Retype new UNIX password:

passwd: password updated successfully

root@ubuntu:~#

In above case if you forget your MySQL root password which is also used to login into MySQL database through PhpMyadmin then try this method : Lost Mysql password or Got Locked