How To Reset Forgotten MySQL Root Password

So you have chosen an awesome cryptic password that not even you can remember! It happens to us all, but fear not, it’s quite a simple job to reset this. Not sure if we should be worried over how easy it is to reset the root password for your mysql server, but we wont complaint for the moment.

So first thing you need to do to be able to do this is have root shell access to your server. The following commands are specific to Red Hat/Centos, but the same process can be used for any linux distro if you update the command accordingly.

Once you are connected to your server you must disable mysql.

service mysqld stop

Now that it is stopped you can enter the following command

mysqld --skip-grant-tables --user=root

You should now have access to update the internal tables for SQL. Now you can log into mysql and reset the password. The semi colon at the end of the line is important! Otherwise the command will keep going with an arrow. I.e ‘->’

 

mysql -u root

UPDATE mysql.user SET Password=PASSWORD('password') WHERE User='root';
FLUSH PRIVILEGES;
quit

Now you should be able to start the server back up.

service start mysqld

Related Articles

Related Questions

Is SharePoint and Power Automate the Right Solution for Our CPA Firm?

I'm seeking advice on whether SharePoint and Power Automate are suitable for a challenge my CPA firm is facing. We're currently using the Thomson...

Can I Use Space from My Windows SSD for Linux Games?

I'm setting up a dual-boot system with Windows on one SSD and Linux on another. While I plan to use Windows for certain tasks...

How do I change my iCloud email after getting married?

Hey everyone! I recently got married and changed my last name. I want to update my iCloud email from my old [email protected] to reflect...

LEAVE A REPLY

Please enter your comment!
Please enter your name here

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

Latest Tools

Online Hash Generator – String to Hash Converter

Need to quickly generate a hash from a string? Whether you're verifying file integrity, securing data, or just experimenting with cryptographic tools, this simple...

Convert CSV To HTML Table

Need to quickly turn CSV data into an HTML table? Whether you're copying data from Excel, Google Sheets, or another spreadsheet, this tool makes...

Student Group Randomizer

Creating fair and balanced groups in the classroom can be time-consuming — especially when you're trying to avoid repetition, manage different skill levels, or...

Random Group Generator

Need to split a list of people, items, or ideas into random groups? Our free Random Group Generator makes it quick and easy. Whether...

Flip Text Upside Down – Free Online Tool

Ever wanted to flip your text upside down just for fun or to grab someone’s attention in a creative way? This free online Upside...

Raffle Ticket Generator

If you're running a fundraiser, charity draw, or local event and need raffle tickets fast, this free online tool lets you generate and print...

Latest Posts

Latest Questions