Reset MySQL root password in Linux

Stop mysqld service:

systemctl stop mysqld
Create a /pwd.txt file with following contents:
cat /pwd.txt 
ALTER USER 'root'@'localhost' IDENTIFIED BY 'pwd123';
be sure that the /pwd.txt will be accessible by mysql user.

Run mysql daemon with --init-file option:
mysqld --init-file=/pwd.txt &
Try to login:
mysql -u root -ppwd123
If login succeded kill mysqld running process and start the service:
killall mysqld #several times
systemctl start mysqld