[root@cx temp]# rpm -ivh mysql-community-server-8.0.21-1.el7.x86_64.rpm warning: mysql-community-server-8.0.21-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY error: Failed dependencies: libaio.so.1()(64bit) is needed by mysql-community-server-8.0.21-1.el7.x86_64 libaio.so.1(LIBAIO_0.1)(64bit) is needed by mysql-community-server-8.0.21-1.el7.x86_64 libaio.so.1(LIBAIO_0.4)(64bit) is needed by mysql-community-server-8.0.21-1.el7.x86_64
[root@cx temp]# cat /var/log/mysqld.log | grep password 2021-11-14T05:16:17.754515Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: :Cld9aHkri:Q
登录mysql
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
[root@cx temp]# mysql -uroot -p Enter password: # 密码输入上面的那个,直接复制就行,密码不会显示 Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 8 Server version: 8.0.21
Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> # 登录成功
修改密码
1 2
mysql> alter user 'root'@'localhost' identified with mysql_native_password by '密码'; Query OK, 0 rows affected (0.00 sec)
退出重新登录
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
mysql> exit; Bye [root@cx temp]# mysql -uroot -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 9 Server version: 8.0.21 MySQL Community Server - GPL
Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.