Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Reset MySQL Root Password On Linux

DZone's Guide to

Reset MySQL Root Password On Linux

· Java Zone
Free Resource

Learn how to troubleshoot and diagnose some of the most common performance issues in Java today. Brought to you in partnership with AppDynamics.

 

 Five easy steps to reset MySQL root password.

  1. Stop the MySQL server.
  2. Start the MySQL server with the --skip-grant-tables option. (it will not prompt for password)
  3. Connect to MySQL server as the root user. 
  4. Setup new MySQL root password.
  5. Exit and restart the MySQL server. 

    
### Shell Commands ###
/etc/init.d/mysql stop
mysqld_safe --skip-grant-tables & 
mysql -u root

### SQL Commands ###
use mysql;
UPDATE user SET password=PASSWORD("new-password") WHERE user='root';
flush privileges;
exit

### Shell Commands ###
/etc/init.d/mysql stop
/etc/init.d/mysql start
mysql -u root -pnew-password  

Understand the needs and benefits around implementing the right monitoring solution for a growing containerized market. Brought to you in partnership with AppDynamics.

Topics:

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}