1、配置YUM源
在MySQL官网中下载YUM源rpm安装包:https://dev.mysql.com/downloads/repo/yum/
wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
安装mysql源
yum localinstall mysql57-community-release-el7-8.noarch.rpm
检查mysql源是否安装成功
yum repolist enabled | grep "mysql.*-community.*"
image.png
2、安装MySQL
yum install mysql-community-server
3、启动MySQL服务
systemctl start mysqld
4、开机启动
systemctl enable mysqld
systemctl daemon-reload
5、修改root本地登录密码
mysql安装完成之后,在/var/log/mysqld.log文件中给root生成了一个默认密码。通过下面的方式找到root默认密码,然后登录mysql进行修改:
set password for 'root'@'localhost'=password('password!');
image.png
6、允许远程连接
grant all on *.* to root@'%' identified by 'password' with grant option;
flush privileges;
作者:yellow_han
链接:https://www.jianshu.com/p/3cf566658ad6
来源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。