In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
The method of changing password before MySQL5.7 version:
Method 1: use the SET PASSWORD command
Mysql-u root
Mysql > SET PASSWORD FOR 'root'@'localhost' = PASSWORD (' newpass')
Method 2: use mysqladmin
Mysqladmin-u root password "newpass"
If root has already set a password, use the following methods
Mysqladmin-u root password oldpass "newpass"
Method 3: edit the user table directly with UPDATE
[root@] # mysql-uroot-p
Mysql > use mysql
Mysql > UPDATE user SET Password = PASSWORD ('newpass') WHERE user =' root'
Mysql > FLUSH PRIVILEGES
You can do this when you lose your root password
Mysqld_safe-skip-grant-tables&
Mysql-u root mysql
Mysql > UPDATE user SET password=PASSWORD ("new password") WHERE user='root'
Mysql > FLUSH PRIVILEGES
MySQL 5.7.22 changes the password in the following ways:
1, version update, the original password field in user has been changed to authentication_string version update, many online tutorials are not applicable, and even the official website documents are not able to operate smoothly. If MySQL is running, kill it first: killall-TERM mysqld. Run mysqld_safe-- skip-grant-tables & if you don't want to be connected remotely at this time: mysqld_safe-- skip-grant-tables-- skip-networking & use mysql connection server to change the password
Mysql > update mysql.user set authentication_string=password ('hwg123') where user='root' and Host =' localhost'
Mysql > exit
[root@Centos7_3 ~] # systemctl restart mysqld
* A special reminder is that there is no Password field in the user table under the new version of mysql database.
Instead, the encrypted user password is stored in the authentication_string field.
2. The error in upgrading mysql is as follows: ERROR 3009 (HY000): Column count of mysql.user is wrong. Expected 45, found 42. Created with MySQL 50556, now running 50722. Please use mysql_upgrade to fix this error. The error is due to the fact that you have upgraded the database and did not use mysql_upgrade to upgrade the data structure after the upgrade.
Solution: use the mysql_upgrade command
Root@localhost ~] # mysql_upgrade-u root-phwg123
3Jing MySQL 5.7.22 change the password after the database is installed
[root@ ~] # cat / var/log/mysqld.log | grep password
[root@] # mysql-uroot-pRir.*sJUX6M*
You need to change the global variable after entering mysql. Otherwise, the password you set should be in line with the password complexity.
Mysql > set global validate_password_policy=0
[root@zabbixserver ~] # systemctl restart mysqld
[root@zabbixserver] # mysql-uroot-pRir.*sJUX6M*
Mysql > ALTER USER USER () IDENTIFIED BY '12345678'
Or something like this:
Mysql > ALTER USER USER () IDENTIFIED BY 'Pass123 passport'
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.