centos 7 安装mysql 5.7
1.下载MySQL官方的 Yum Repository
wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm

2.yum 安装MySQL官方的 Yum Repository
yum -y install mysql57-community-release-el7-10.noarch.rpm

3.安装MySQL服务器
yum -y install mysql-community-server

4.启动mysql
systemctl start mysqld.service
5.查看 mysql 是否安装成功
ps -ef | grep mysql
mysqladmin --version

6.启动mysql,设置开机自启,查看mysql状态
systemctl start mysqld
systemctl enable mysqld
systemctl status mysqld

7.在日志文件中找到root密码
grep "password" /var/log/mysqld.log

8.登录mysql
mysql -uroot -p
9.修改MySQL默认密码, 密码设置必须要大小写字母数字和特殊符号(,/';:等)
alter user 'root'@'localhost' identified by 'Root123,';
10.开启远程访问限制
grant all privileges on *.* to 'root'@'%' identified by 'Root123,' with grant option;
flush privileges;
exit
11.开启安全组权限,远程连接测试


浙公网安备 33010602011771号