centos7 安装MySQL5.7

下载mysql安装包

wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm

安装mysql 安装源:

yum -y localinstall mysql57-community-release-el7-11.noarch.rpm 

在线安装mysql

yum -y install mysql-community-server

 安装mysql出现Public key for mysql57-community-release-el7-11.noarch.rpm is not installed

可以使用以下命令即可

rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022

centos yum安装mysql出现Public key for mysql-community-server-5.7.37-1.el7.x86_64.rpm is not installed_searlas的博客-CSDN博客使用yum -y install mysql-community-server安装mysql时候提示:The GPG keys listed for the “MySQL 5.7 Community Server” repository are already installed but they are not correct for this package.Check that the correct key URLs are configured for this repository.Faihttps://blog.csdn.net/searlas/article/details/123393829 

启动mysql服务

systemctl start mysqld

设置开机启动

systemctl enable mysqld

systemctl daemon-reload

修改root密码,mysql会生成一个临时密码,查看临时密码

vim /var/log/mysqld.log

记住初始密码,修改root密码

mysql -uroot -p

修改临时密码

ALTER USER 'root'@'localhost' IDENTIFIED BY '0xh*sKIo)9JL';

查看validate-password属性

修改validate_password_length和validate_password_policy的值

set global validate_password_length=4;

set global validate_password_policy=0;

设置简单密码

set password=password("123456");

root 用户远程登录权限

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;

刷新权限

flush privileges;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值