Yum方式安装mysql服务
步骤一:首先下载并安装mysql的yum源
wget http://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm yum -y install mysql57-community-release-el7-11.noarch.rpm yum -y install mysql-server --nogpgcheck
--nogpgcheck (不校验数字签名)
步骤二:启动mysql
systemctl start mysqld.service
systemctl status mysql.service
步骤三:修改密码
1. 查看临时密码
cat /var/log/mysqld.log| grep password
2. 使用临时密码进入
mysql -uroot -p
#输入临时密码进入,但是不能做任何操作,因为为了安全起见,需要马上立即修改临时密码。
3. 修改root密码,version-5.7要求必须首先修改密码,不修改其他所有的命令不可以使用。然后给其他机器授权能够访问mysql,立即刷新配置
ALTER USER USER() IDENTIFIED BY '123456Admin@123'; grant all privileges on *.* to 'root'@'%' identified by '123456Admin@123' with grant option; flush privileges;
【降低mysql密码安全策略】
set global validate_password_policy=0; set global validate_password_length=1; flush privileges; alter user 'root'@'localhost' identified by 'root'; grant all privileges on *.* to 'root'@'%' identified by 'root' with grant option; flush privileges;