Tips

1
2
3
4
5
6
7
8
FLUSH PRIVILEGES;


-- MySQL 5.7.6 and newer as well as MariaDB 10.1.20 and newer
ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';

-- MySQL 5.7.5 and older as well as MariaDB 10.1.20
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('new_password');

参考链接

https://www.digitalocean.com/community/tutorials/how-to-reset-your-mysql-or-mariadb-root-password