In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
The following is about how to log in when you forget your mysql password. The secret of the text is that it is close to the topic. So, no gossip, let's go straight to the following, I believe you will benefit from reading this article that you forget how to log in with your mysql password.
If the database is logged in for the first time
The linux system generates an original password for the database in the file / var/log/mysqld.log:
Grep "temporary password" / var/log/mysqld.log found the original password
Log in # mysql-uroot-p 'password you found'
Mysql > set global validate_password_policy=0 / / set password authentication policy
Mysql > set global validate_password_length=6 / / set password length at least 6 digits
Mysql > alter user root@ "localhost" identified by "123456" / / set password I am the key to remember the first setting, must alter password
Restart the service and log in again to systemctl restart mysqld mysql-uroot-p123456
For the password authentication policy, the above is one-time, and the permanent setting needs to set the configuration file.
Vim / etc/my.cnf
[mysql]
Validate_password_policy=0
Validate_password_length=6
: wq
Just restart the service.
2. if the database is not logged in for the first time:
Modify the configuration file to skip the monitoring of password monitoring table
Vim / etc/my.cnf
[mysql]
Skip_grant_tables
# validate_password_policy=0
# validate_password_length=6
: wq
Restart the service systemctl restart mysqld
Modify the value of the field in which the database password is stored after entering the database
This field is the authentication_string in the user table in the mysql library
# mysql
Mysql > update mysql.user set authentication_string=password ("New password you want to set") where user= "root"
And host= "localhost" / I am explaining that partitioning password () is the encryption function that comes with mysql, because mysql cannot store your password text in its own table.
Mysql > flush privileges;/ I explain that split flush is refresh, and this step is to refresh permissions, that is, the process of storing your password changes in the table, essential! Otherwise, the new password will be updated in vain.
After exiting the database, modify the configuration file so that you do not have to skip the password monitoring table and log in with your new password
Mysql > exit
Vim / etc/my.cnf
[mysqld]
# skip_grant_tables
Validate_password_policy=0
Validate_password_length=6
: wq
# systemctl restart mysqld
# mysql-uroot-p New password
3. Important additions:
Monitor whether this variable is used when writing password policy
# find /-name "validate_password.so"
Yes, the following results can be found, which can be done according to one or two
/ usr/lib64/mysql/plugin/debug/validate_password.so
/ usr/lib64/mysql/plugin/validate_password.so
If there is no result of the query, install the plug-in and modify the configuration file, and then follow one or two steps as follows:
Modify the configuration file: vim / etc/my.cnf
[mysqld]
Plugin-load=validate_password.so / I am explaining the splitter line: loading plug-ins
Validate-password=FORCE_PLUS_PERMANENT / I am explaining the splitter line: force installation to prevent the plug-in from being deleted at run time
Install the plug-in:
Mysql > INSTALL PLUGIN validate_password SONAME 'validate_password.so'
Restart the service and monitor whether the installation is successful:
Systemctl restart mysqld
# find /-name "validate_password.so"
Is there anything you don't understand about how to log in when you forget the password of mysql above? Or if you want to know more about it, you can continue to follow our industry information section.
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.