Change Root Password in MySQL

Steps to change root password in MySQL

--Only one command will change the ROOT Password in MySQL
mysqladmin -u root -p<old-password> password <new-password>

Example of Changing root password:

C:\Program Files\MySQL\MySQL Server 8.0\bin>mysqladmin -u root -pPassword1 password Newpassword1
mysqladmin: [Warning] Using a password on the command line interface can be insecure.
Warning: Since password will be sent to server in plain text, use ssl connection to ensure password safety.

C:\Program Files\MySQL\MySQL Server 8.0\bin>mysql -u root -p
Enter password: ************   --<NEW PASSWORD>
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 29
Server version: 8.0.24 MySQL Community Server - GPL

Copyright (c) 2000, 2021, Oracle and/or its affiliates.

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

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

mysql> show databases;
| Database           |
| database           |
| information_schema |
| mysql              |
| performance_schema |
| sakila             |
| sys                |
| test_bkp           |
| world              |
8 rows in set (0.01 sec)

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.