In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces how MySQL/MariaDB resets the Root password, which has certain reference value. Interested friends can refer to it. I hope you will gain a lot after reading this article. Let Xiaobian take you to understand it together.
Reset MySQL or MariaDB Root password
First, stop the database.
If you are using MySQL, type the following command and press Enter.
$ sudo systemctl stop mysql
For MariaDB:
$ sudo systemctl stop mariadb
Next, restart the database without permission checking using the following command:
$ sudo mysqld_safe --skip-grant-tables &
Here, the--skip-grant-tables option lets you connect without a password and all permissions. If you start the server with this option, it also enables the--skip-networking option, which prevents other clients from connecting to the database server. And, the & symbol is used to run commands in the background, so you can enter other commands in the following steps. Please note that the above command is dangerous and your database becomes insecure. You should only run this command for a short time to reset the password.
Next, log in to the MySQL/MariaDB server as root:
$ mysql
At the mysql > or MariaDB [(none)] > prompt, run the following command to reset the root password:
UPDATE mysql.user SET Password=PASSWORD('NEW-PASSWORD') WHERE User='root';
Replace NEW-PASSWORD in the above command with your own password.
Then, exit the mysql console by typing the following command.
FLUSH PRIVILEGES;exit
Finally, close the database that was previously running with the--skip-grant-tables option. To this end, run:
$ sudo mysqladmin -u root -p shutdown
You will be asked to enter the MySQL/MariaDB user password you set in the previous step.
Now, start MySQL/MariaDB service normally using the following command:
$ sudo systemctl start mysql
For MariaDB:
$ sudo systemctl start mariadb
Verify that the password has indeed changed using the following command:
$ mysql -u root -p Thank you for reading this article carefully. I hope that the article "MySQL/MariaDB How to Reset Root Password" shared by Xiaobian will be helpful to everyone. At the same time, I hope that everyone will support it a lot. Pay attention to the industry information channel. More relevant knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.