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

Initial login for RHEL7_mysql5.7.17_ installation

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

1 depicts

After installing mysql 5.7.17 in yum mode on rhel7.2 x64 server.

Run mysql -u root -p without knowing what the root password is.

[root@localhost bin]# mysql -u root -p

Enter password:

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

2 Detailed steps

Temporary passwords are stored in the/var/log/mysqld.log file after Mysql installation is complete. Get an auto-generated temporary password

[root@localhost bin]# grep "password" /var/log/mysqld.log

2016-12-26T05:36:59.714175Z 1 [Note] A temporary password is generated for root@localhost: tw=gB-DvY4CI

Skip root Temporary password Login database Change password

1. Stop mysql:systemctl stop mysqld

2. Set the mySQL environment option

systemctl set-environment MYSQLD_OPTS="--skip-grant-tables"

3. Start mysql usig the options you just set

systemctl start mysqld

4. Login as root

mysql -u root

5. Update the root user password with these mysql commands

mysql> UPDATE mysql.user SET authentication_string = PASSWORD('MyNewPassword') WHERE User = 'root' AND Host = 'localhost';

mysql> FLUSH PRIVILEGES;

mysql> quit

6. Stop mysql

systemctl stop mysqld

7. Unset the mySQL envitroment option so it starts normally next time

systemctl unset-environment MYSQLD_OPTS

8. Start mysql normally:

systemctl start mysqld

9. Try to login using your new password:

mysql -u root -p

mysql 5.7 mysqld_safe command not foundhttp://www.th7.cn/db/mysql/201610/210252.shtml

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