Resetting mariadb root password in aws

In a linux terminal on the awm ec2 VM, enter the following commands:

sudo /etc/init.d/mysql stop
sudo mysqld_safe --skip-grant-tables &
mysql -uroot
use mysql;

update user set authentication_string=PASSWORD("mynewpassword") where User='root';

flush privileges;

quit