$ mysql -u root -p
use mysql;
# 5.6 이하
> update user set password=password('new password') where user = 'root';
# 5.7 이상
> update user set authentication_string=password('new password') where user = 'root';
# 8.x 이상
> alter user 'root'@'localhost' identified with mysql_native_password by 'new password';
> flush privileges;