Inspect the status from MariaDB or MySQL
# systemctl status mariadb
Stop service
# systemctl stop mariadb
Start mysqld_safe service in background
# mysqld_safe --skip-grant-tables --skip-networking &
Access to MariaDB and change root password
# mysql -u root
MariaDB [(none)]> use mysql;
MariaDB [mysql]> update user set password=PASSWORD("NewPasswordHere") where User='root';
MariaDB [mysql]> update user set plugin="";
MariaDB [mysql]> flush privileges;
MariaDB [mysql]> exit
Stop mysqld_safe service
# systemctl stop mariadb
# killall -s 9 mysqld_safe
Start MariaDB service
# systemctl start mariadb
Verify root password change
# mysql -u root -p