Reset MySQL root password on Linux
Sometimes it becomes necessary to restore the password of the MySQL database administrator (the root of a user or another superuser, for example, if the superuser is not root or root has been deleted) on a server running Linux. Below, we will take a step-by-step look at how to reset the MySQL admin password.
How to reset MySQL root password on Linux
1. Stop MySQL by running the command below:
/etc/init.d/mysql stop
2. We start the MySQL server with special parameters (without privilege checking):
/usr/bin/mysqld_safe --skip-grant-tables --user=root &
3. Run the MySQL client:
mysql -u root
4. Set a new password for the root user to execute this SQL query below:
mysql>UPDATE mysql.user SET Password=PASSWORD('password_for_root') WHERE User='root';
Where password_for_root - this is the new password for the root MySQL user.
5. After that, reset the privileges with the command:
mysql>FLUSH PRIVILEGES;
6. And exit the MySQL client:
mysql>\q
7. After that need to restart the MySQL server in normal mode by running the command:
/etc/init.d/mysql restart
These are all the steps necessary to reset the root password in MySQL. After that, you can use the new root password to connect.
Latest news
Discount on all Ukrainian domains until 10/21/2022!
Dear users! For a whole week -15% discount for registration of all Ukrainian domains using the promo code defendersday22!Increase in price of a number of Ukrainian domains UA ccTLD!
Dear users! From October 1, 2022, we are waiting for a rise in price in a number of Ukrainian domains - in.ua, od.ua, mk.ua!Important changes in some Ukrainian domains!
Dear users! In some Ukrainian domain zones, the Redemption period for domains has been increased from 30 to 60 days.Rise in price of dedicated IPv4 in Germany!
Dear users! In Germany, additional dedicated IP addresses (IPv4) and IP networks have risen significantly.Latest Blog Posts