In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Method 1:
1. Stop the MySQL service
# kill `cat / var/run/mysqld/ mysqld.pid`
Or
# pkill mysqld
two。 Create a text file for password assignment statements
# vi mysql-init
ALTER USER 'root'@'localhost' IDENTIFIED BY' MyNewPassport 6'
Reset the password before loading the authorization table.
3. Start the MySQL service using the-init-file option
# mysqld-init-file=mysql-init-user=mysql &
4. Delete the text file and connect to MySQL with the new password
# rm-f mysql-init
# mysql-uroot-p'MyNewPassport 6'
5. Stop the MySQL service and start normally
# kill `cat / var/run/mysqld/ mysqld.pid`
# systemctl start mysqld
Method 2:
1. Stop the MySQL service
# kill `cat / var/run/mysqld/ mysqld.pid`
# pkill mysqld
two。 Start the MySQL service using the-- skip-grant-tables-- skip-networking option
# mysqld-skip-grant-tables-skip-networking-user=mysql
-- skip-grant-tables: skip authorization table authentication
-- skip-networking: after adding the option to skip the authorization table, all people can log in without a password, which is very insecure. This option does not listen on the network to prevent malicious login.
3. Password-less connection MySQL
# mysql
4. Reset password
Mysql > FLUSH PRIVILEGES
Mysql > ALTER USER 'root'@'localhost' IDENTIFIED BY' MyNewPassport 6'
5. Stop the MySQL service and start normally
# kill `cat / var/run/mysqld/ mysqld.pid`
# systemctl startmysqld
Simple, fast and effective, remember to collect! What if one day I can't find my root password!
To learn more about MySQL5.7 's latest database technology, take a look at my recorded video tutorial: https://ke.qq.com/course/251737
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.