1删除yum remove mysql-libs
不卸载会报如下的错误
红帽安装rpm安装MySQL时爆出警告: 警告:MySQL-server-5.5.46-1.linux2.6.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY 原因:这是由于yum安装了旧版本的GPG keys造成的 解决办法:后面加上 --force --nodeps 如: rpm -ivh MySQL-server-5.5.46-1.linux2.6.x86_64.rpm --force --nodeps 从 RPM 版本 4.1 开始,在安装或升级软件包时会检查软件包的签名。
2 rpm命令安装mysql
rpm -ivh mysql-community-common-5.7.19-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.19-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-5.7.19-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-5.7.19-1.el7.x86_64.rpm
3启动mysql
systemctl start mysqld.service
systemctl status mysqld.service
systemctl stop mysqld.service
chkconfig mysqld on 开机自动启动mysql
4 mysql修改root密码
找到临时密码grep ‘temporary password’ /var/log/mysqld.log
mysql -uroot -p”加上临时密码登录”
use mysql 数据库
查看 mysql 初始的密码策略,必须在修改密码后才能查看
输入语句 SHOW VARIABLES LIKE ‘validate_password%’;进行查看
set global validate_password_policy=LOW; 修改当前密码策略为低等级
set global validate_password_length=6; 修改当前密码长度为6
alter user ‘root’@‘localhost’ identified by ‘123456’;
GRANT ALL PRIVILEGES ON . TO ‘root’@’%’ IDENTIFIED BY ‘123456’ WITH GRANT OPTION;
添加权限 .是所有表和库 @%代表所有的连接 后面是免密 123456
delete from user where host !=’%’;
flush privileges;
quit; 退出
systemctl restart mysqld.service 重启数据库服务器