MySQL 5.6 이하
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('패스워드');
FLUSH PRIVILEGES;
MySQL 5.7 이하
UPDATE mysql.user SET password=PASSWORD('패스워드') WHERE user='root' AND Host='localhost';
FLUSH PRIVILEGES;
MySQL 5.7 이상
UPDATE mysql.user SET authentication_string=PASSWORD('패스워드') WHERE user='root' AND Host='localhost';
FLUSH PRIVILEGES;
MySQL 5.7.6 이상
ALTER USER 'root'@'localhost' IDENTIFIED BY '패스워드';
FLUSH PRIVILEGES;
MySQL 8.0 이상
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '패스워드';
FLUSH PRIVILEGES;