mysql forgot password code example

Example 1: mysql set root password

use mysql;

update user set authentication_string=PASSWORD("mynewpassword") where User='root';

flush privileges;

quit

Example 2: how to change mysql localhost password

ALTER USER 'root'@'localhost' IDENTIFIED BY 'NewPassword'

Example 3: where to locate set password for mysql

ALTER USER 'root'@'localhost' IDENTIFIED BY 'PASSWORD';

Example 4: default password of mysql

mysqladmin -u root password NEWPASSWORD

Example 5: default password of mysql

mysql_secure_connection

Example 6: what is default mysql database password in linux

$ sudo apt install mysql-server
$ sudo cat /etc/mysql/debian.cnf

Tags:

Sql Example