$ mysql
[MariaDB [(none)]> use mysql
// mysql 5.6 이하
[mysql]> set password for 'root'@'localhost' = PASSWORD('1234');
// mysql 5.7 이상
[mysql]> set authentication_string=password('new password') where user = 'root';
// mysql 8.x 이상
[mysql]> alter user 'root'@'localhost' identified with mysql_native_password by 'new password';
// mariadb 10.4 이상
[MariaDB [mysql]> set password=password('1234');
[MariaDB [mysql]> flush privileges;
mysql -uroot -p1234