LiveZilla Live Help
  • best dedicated server provider Company
  • Call : +91(0141)-4113929
How to Reset MySQL root Password in Linux
By Gopal on Sat Aug 2018 11:49:38
Q. How to reset MySQL root password in Linux? How do I recover MySQL root password? I forgot MySQL root password, steps to change MySQL root password? How to reset MySQL root password using the command line. How to reset forgotten MySQL root password on Linux? How to reset MySQL 5.7 root password?

MySQL is an open source database software widely used for data storage. Sometimes we forgot MySQL root password. So don’t be panic, This blog will help you to reset MySQL root password with simple steps.

Step 1 – Start MySQL in Safemode
First of all, you are required to stop running MySQL server. Use one of the following commands to stop MySQL server on your Linux system.

# systemctl stop mysql.service    //For Systemd based Systems  “

Now login to MySQL server as root user and change password using the following set of commands. This will reset MySQL root password on your system.

For MySQL 5.6 or Below

# mysql -u root
<prompt>mysql></prompt> USE mysql;

<prompt>mysql></prompt> FLUSH PRIVILEGES;
For MySQL 5.7 or Above
<prompt>mysql></prompt> FLUSH PRIVILEGES;
# service mysql start
# systemctl start mysql.service
Step 4 – Verify New Password

After resetting MySQL root account password and restarting, just verify new password by login.

Welcome to the MySQL monitor.  Commands end with ; or \g.

Server version: 5.5.57 MySQL Community Server (GPL)
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

How to Reset MySQL root Password in Linux



Please login to comment. Login
Contact Support | To request a call back from sales team Whatsapp to 6376938641 | Sales : 6376792701 | Billing : 6376793158