转载:https://www.jianshu.com/p/531cc35b15e7
下载yum源:
wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
安装yum源
rpm -Uvh mysql57-community-release-el7-11.noarch.rpm
查看有哪些版本的mysql:
yum repolist all | grep mysql
安装
yum install -y mysql-community-server
启动mysql
systemctl start mysqld
查看状态
systemctl status mysqld
mysql5.7的新特性之一就是在初始化的时候会生成一个自定义的密码
grep 'temporary password' /var/log/mysqld.log
修改密码
SET PASSWORD = PASSWORD('Admin123!');
设置远程可以登录
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'Admin123!' WITH GRANT OPTION;
flush privileges;
重启数据库,使配置生效。
systemctl restart mysqld
设置开机启动
systemctl enable mysqld
systemctl daemon-reload