2020/06/05

MySQL reset password for user

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'bla'

For mysql 8.0.12+

PASSWORD() is deprecated, SET PASSWORD is disabled, ALTER USER is disabled as well.
1. stop mysql service
2. Start it this way: /usr/local/mysql/bin/mysqld_safe --skip-grant-tables
3. Login (mysql) and exec: update user set authentication_string='' where
User='root'; 4. killall mysqld
5. Start service again