Centos7的mysql安装

下载官方mysql源

1
wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm

加载rpm源

1
rpm -ivh mysql-community-release-el7-5.noarch.rpm

yum安装

1
yum install mysql mysql-devel mysql-server -y

开启mysqlserver

1
2
3
systemctl start mysqld
//设置开启启动
systemctl enable mysqld

设置mysql远程权限

1
2
3
4
5
6
7
8
9
10
11
12
13
--切换数据库
use mysql;
--查看表
show tables;
--查看表的数据
select host,user,password from user;
--插入权限数据
grant all privileges on *.* to 'root'@'%' identified by '123' with grant option;
--删除本机的用户访问权限(可以执行也可以不执行)
delete from user where host!='%';
--刷新权限或者重启mysqld的服务
service mysqld restart;--(重启mysql服务)
flush privileges;--(刷新权限)