欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

CentOS7安装MySQL错误解决:error: Failed dependencies net-tools is needed by

程序员文章站 2022-07-11 07:58:43
...

错误一:

错误描述:
[[email protected] software]# rpm -ivh mysql-community-server-5.7.19-1.el7.x86_64.rpm warning: mysql-community-server-5.7.19-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY error: Failed dependencies: net-tools is needed by mysql-community-server-5.7.19-1.el7.x86_64

解决方法:

方法一(无网):后面加上 --force --nodeps
方法二(有网):yum install net-tools
如:
[[email protected] software]# rpm -ivh mysql-community-server-5.7.19-1.el7.x86_64.rpm --force --nodeps
warning: mysql-community-server-5.7.19-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing… ################################# [100%]
Updating / installing…
1:mysql-community-server-5.7.19-1.e################################# [100%]

错误解析:
1.–nodeps就是安装时不检查依赖关系,比如你这个rpm需要A,但是你没装A,这样你的包就装不上,用了–nodeps你就能装上了。

2.–force就是强制安装,比如你装过这个rpm的版本1,如果你想装这个rpm的版本2,就需要用–force强制安装。

3.net-tools,Linux的基本网络实用程序集合,mysql的依赖。

错误二:

错误描述:ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password:yes)

解决方法:

1、停止mysql服务:systemctl stop mysqld.service
2、修改配置文件无密码登录
vi /etc/my.cnf
在最尾部加上skip-grant-tables 这是表示没有密码可登录,授权跳跃。
保存
3、启动mysql:systemctl start mysqld.service
4、登录musql:mysql -u root
此处注意不要加-p
5、登录后修改密码:alter user ‘root’@‘localhost’ identified by ‘想修改的密码’;
6、回到第二步骤去掉加上的
skip-grant-tables
保存 重启mysql服务就ok了



  注意:   
    登录后修改MySQL密码:alter user 'root'@'localhost' identified by '修改的密码';
    mysql> alter user 'root'@'localhost' identified by 'root';
    ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
    错误1819 (HY000):您的密码不满足当前的策略要求,密码设置过小
    此时需要修改级别与最小的默认密码位数
    set global validate_password_policy=0; 因密码过于简单,调整MySQL密码验证规则
    set global validate_password_length=4; 密码长度限制 ,这个值最小要是4
    然后再进行设置密码就好了