Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Mysql5.7 did not generate the initial password. MySQL _ secert file, log in to the database

2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Today, I encountered a problem when installing mysql5.7 on CentOS 6.5. there is no initialization password.

No password is required for first login in versions prior to mysql5.7, but an initialization password / root/.mysql_secert will be generated from 5.7 onwards

Cat / root/.mysql_secert can view the initialization password.

But my installation did not find the .mysql _ secert file.

The solution to this situation:

Mysqld_safe-- user=mysql-- skip-grant-tables & # Skip authorization to start mysql mysql-uroot-p > use mysql; > desc user; # found that the password parameter password is missing. | authentication_string | text | YES | | NULL | | password_expired | enum | NO | | N | | password_last_changed | timestamp | YES | | NULL | | password_lifetime | smallint (5) unsigned | YES | NULL | | account_locked | enum ('N') | 'Y') | NO | | N | | +-- +-- +-+ > select user,host,authentication_string,password_expired from user +-+-+ | user | host | authentication_string | password_expired | +-+- -root | localhost | * 9AA01F6E2A80A823ACB72CC07337E2911404B5B8 | Y | | mysql.sys | localhost | * THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | N | +- -- +-# it is not difficult to find that the password of the root account has expired here There is also an extra mysql.sys user > update user set authentication_string=password ('123456') where user='root' # change the password to 123456 > flush privileges

Log in to mysql again and stop all mysql processes first

Mysqld_safe-- user=mysql & mysql-uroot-p > show databases;ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.# reports an error and needs to use alter user to change its password, so the first thing to do when logging in is to change the initial password of mysql. Otherwise, an error will be reported if you use it > alter user root@'localhost' identified by 'aolens123..'

# that would be great

You can see that the password field of 5.7 has been changed to authentication_string.

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.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report