Can't connect to database after password reset

Hello Community

I have just changed root and openmrs-user passwords by running the following commands

SET PASSWORD FOR 'root'@'localhost' = PASSWORD('mypassword');
SET PASSWORD FOR 'openmrs-user'@'localhost' = PASSWORD('mypassword');
FLUSH PRIVILEGES;

After that I updated openmrs runtime properties file and restarted both APP and DB servers. Now when I try to log into mysql by issuing any of the below commands

sudo mysql -u openmrs-user -p
sudo mysql -u root -p

I get this error

Access denied for user 'openmrs-user'@'localhost' (using password: YES)
Access denied for user 'root'@'localhost' (using password: YES)

When I try to access mysql safe mode by issuing this command,

sudo mysqld_safe --skip-grant-tables &

I get this message

mysqld_safe: command not found

I am now stuck


SYSTEM DETAILS

Mysql version

mysql-community-client.x86_64          5.7.28-1.el7                    @mysql57-community
mysql-community-common.x86_64          5.7.28-1.el7                    @mysql57-community
mysql-community-libs.x86_64            5.7.28-1.el7                    @mysql57-community
mysql-community-libs-compat.x86_64     5.7.28-1.el7                    @mysql57-community
mysql-community-server.x86_64          5.7.28-1.el7                    @mysql57-community

Bahmni version

bahmni-installer-0.92-142.noarch

Front-end error