How to reset root MariaDB password on Ubuntu 18.04 Bionic Beaver Linux - LinuxConfig.org

The objective is to reset lost root MariaDB password on Ubuntu 18.04 Bionic Beaver Linux. Please note that if you have just installed your MariaDB server and are unable to login as root user with:

$ mysql -u root
ERROR 1698 (28000): Access denied for user 'root'@'localhost'

This is a companion discussion topic for the original entry at https://linuxconfig.org/how-to-reset-root-mariadb-password-on-ubuntu-18-04-bionic-beaver-linux