In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Editor to share with you how to reset the MySQL root password in Linux. I hope you will gain a lot after reading this article. Let's discuss it together.
MySQL is an open source database software widely used for data storage. Sometimes we forget our MySQL root password, but there's no need to be nervous. This article will show you how to reset your MySQL root password in a simple step.
Step 1: start MySQL in safe mode
First, you need to stop running the mysql server. We use one of the following commands to stop the MySQL server on the Linux system.
# service mysql stop / / for SysVinit-based systems # systemctl stop mysql.service / / for Systemd-based systems
Now start the mysql server using the-- skip grant tables option in safe mode. Start MySQL in safe mode using the following command. In safe mode, MySQL does not prompt for a login password.
# mysqld_safe-- skip-grant-tables &
Step 2: reset the mysql root password
Now log in to the mysql server as root and change the password using the following command. This will reset the mysql root password on the system.
For MySQL5.6 or earlier
# mysql-u root mysql > USE mysql; mysql > UPDATE user SET password=PASSWORD ("NEW-PASSWORD") WHERE User='root'; mysql > FLUSH PRIVILEGES; mysql > quit
For MySQL5.7 or later
# mysql-u rootmysql > SET PASSWORD FOR 'root'@'localhost' = PASSWORD ("NEW-PASSWORD"); mysql > FLUSH PRIVILEGES;mysql > quit
Step 3: restart the mysql server
After changing the password, stop the mysql (running in safe mode) service and restart it using the following command.
/ / SysVinit-based system # service mysql stop # service mysql start// Systemd-based system # systemctl stop mysql.service# systemctl start mysql.service
Step 4: verify the new password
After you reset your mysql root account password and restart it, you only need to log in to verify the new password.
# mysql-u root-pEnter password: * Welcome to the MySQL monitor. Commands end with; or\ g.Your MySQL connection id is 29Server 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 itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or'\ h' for help. Type'\ c'to clear the current input statement.mysql > after reading this article, I believe you have a certain understanding of the method of resetting the MySQL root password in Linux. Want to know more about it. Welcome to follow the industry information channel. Thank you for reading!
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.