赞
踩
wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
yum localinstall mysql57-community-release-el7-8.noarch.rpm
yum install mysql-community-server
systemctl start mysqld
systemctl status mysqld
源 "MySQL 5.7 Community Server" 的 GPG 密钥已安装,但是不适用于此软件包。请检查源的公钥 URL 是否配置正确。
失败的软件包是:mysql-community-libs-5.7.44-1.el7.x86_64
GPG 密钥配置为:file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
总计:222 M
Downloading packages:
warning: /var/cache/yum/x86_64/7/mysql57-community/packages/mysql-community-libs-5.7.44-1.el7.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY
从 file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql 检索密钥
源 "MySQL 5.7 Community Server" 的 GPG 密钥已安装,但是不适用于此软件包。请检查源的公钥 URL 是否配置正确。
失败的软件包是:mysql-community-libs-5.7.44-1.el7.x86_64
GPG 密钥配置为:file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
[root@#localhost yiduoyun]# [root@#localhost yiduoyun]# systemctl start mysqld [root@#localhost yiduoyun]# [root@#localhost yiduoyun]# systemctl status mysqld ● mysqld.service - MySQL Server Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled) Active: active (running) since 一 2024-01-15 22:46:29 CST; 25s ago Docs: man:mysqld(8) http://dev.mysql.com/doc/refman/en/using-systemd.html Process: 3418 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS) Process: 3318 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS) Main PID: 3420 (mysqld) CGroup: /system.slice/mysqld.service └─3420 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid 1月 15 22:46:21 #localhost.localdomain hadoop2 systemd[1]: Starting MySQL Server... 1月 15 22:46:29 #localhost.localdomain hadoop2 systemd[1]: Started MySQL Server. [root@#localhost yiduoyun]#
参考
https://blog.csdn.net/qq_43408367/article/details/127299840
之后就可以正常进行下一步操作了
grep ‘temporary password’ /var/log/mysqld.log //会生成临时密码
mysql -uroot -p”sZlks?>yp2L>”
[root@#localhost yiduoyun]# grep 'temporary password' /var/log/mysqld.log
2024-01-15T14:46:25.750530Z 1 [Note] A temporary password is generated for root@localhost: X)2SKfrUB!gM
取消mysql密码规范限制
set global validate_password_policy=0;
set global validate_password_length=1;
重设密码
alter user 'root'@'localhost' identified by '123456';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
flush privileges;
退出mysql客户端,使用新密码重新登录
mysql -uroot -p123456
[root@#localhost yiduoyun]# mysql -uroot -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.7.44 Copyright (c) 2000, 2023, Oracle and/or its affiliates. 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> set global validate_password_policy=0; Query OK, 0 rows affected (0.01 sec) mysql> set global validate_password_length=1; Query OK, 0 rows affected (0.00 sec) mysql> alter user 'root'@'localhost' identified by '123456'; Query OK, 0 rows affected (0.00 sec) mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION; Query OK, 0 rows affected, 1 warning (0.00 sec) mysql> flush privileges; Query OK, 0 rows affected (0.00 sec) mysql> quit; Bye [root@#localhost yiduoyun]# mysql -uroot -p123456 mysql: [Warning] Using a password on the command line interface can be insecure. Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 3 Server version: 5.7.44 MySQL Community Server (GPL) Copyright (c) 2000, 2023, Oracle and/or its affiliates. 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> quit; Bye
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。