How to reset Mysql password

Posted by Md masud
2
Aug 2, 2019
464 Views

Reset mysql pass

Step-1

run: sudo mysql -u root

Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.7.26-0ubuntu0.18.04.1 (Ubuntu)

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective computer owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

Step-2

run: mysql> use mysql;

keyboards Reading table information for of table and column names You can turn off this feature to get a quicker startup with -A

Database changed

Step-3

run: mysql> update user set authentication_string=PASSWORD('masud270') where user='root';

Query OK, 1 row affected, 1 warning (0.04 sec) Rows matched: 1 Changed: 1 Warnings: 1


step-4

mysql> update user set plugin='mysql_native_password' where user='root'; Query OK, 1 row affected (0.01 sec) Rows matched: 1 Changed: 1 Warnings: 0


Step-5

mysql> flush privileges; Query OK, 0 rows affected (0.00 sec)

mysql> exit Bye

1 people like it
avatar
Comments
avatar
Please sign in to add comment.