1.安装mysql源:
rpm -ivh mysql-community-release-el7-5.noarch.rpm
2.安装mysql服务
yum -y install mysql-server
3.设置开启启动,启动mysql服务:
systemctl enable mysqld.service
systemctl start mysqld.service
查看mysql运行状态:systemctl status mysqld.service
mysql_secure_installation 初始化数据库
4.设置root密码,配置远程连接访问权限:
a.进入mysql: mysql -uroot
b.设置root密码:set password = password(‘XXX‘)
c.设置远程连接访问:
grant all privileges on *.* to ‘root‘@‘localhost‘ identified by ‘xxx‘ with grant option;
grant all privileges on *.* to ‘root‘@‘%‘ identified by ‘xxx‘ with grant option;
grant all privileges on *.* to ‘root‘@‘127.0.0.1‘ identified by ‘xxx‘ with grant option;
flush privileges;
exit;
配置成功。
centos7 mysql数据库安装指南
原文:https://www.cnblogs.com/sausage/p/10351033.html