yum方式安装MySQL
yum方式安装MySQL服务
1.下载MySQL的yum源配置
wget http://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
2.安装MySQL的yum源
yum -y install mysql57-community-release-el7-11.noarch.rpm
3.yum方式安装MySQL
yum -y install mysql-server --nogpgcheck
--nogpgcheck (不校验数字签名)
4.启动mysql服务
systemctl start mysqld.service
查看状态
systemctl status mysqld.service
5.查看MySQL临时密码
cat /var/log/mysqld.log| grep password
6.使用临时密码进入MySQL
7.修改root密码
ALTER USER USER() IDENTIFIED BY '123456Admin@123';
8.给其他机器授权能够访问MySQL
grant all privileges on *.* to 'root'@'%' identified by '123456Admin@123' with grant option; flush privileges;
9.修改MySQL默认的密码策略(使MySQL可以设置简单的密码)
set global validate_password_policy=0; set global validate_password_length=1; flush privileges;
10.修改root用户的密码为password
alter user 'root'@'localhost' identified by 'password';
11.修改localhost之外,远程连接用户的密码为password
grant all privileges on *.* to 'root'@'%' identified by 'password' with grant option;
12.退出MySQL
quit;