centos 7 安装mysql 5.7

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

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

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

4.启动mysql
systemctl start mysqld.service

5.查看 mysql 是否安装成功

ps -ef | grep mysql
mysqladmin --version

centos 7 安装mysql 5.7

6.启动mysql,设置开机自启,查看mysql状态

systemctl start mysqld
systemctl enable mysqld
systemctl status mysqld

centos 7 安装mysql 5.7

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

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.开启安全组权限,远程连接测试
centos 7 安装mysql 5.7

上一篇:centos7安装mysql8.0.22


下一篇:CentOS 7安装MySQL5.7