1、下载MySQL官方的Yum Repository
wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
执行上述命令,下载MySQL官方的Yum Repository。
[root@typecodes ~]# wget -i http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm
--2016-02-03 18:36:02-- http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm
Resolving dev.mysql.com (dev.mysql.com)... 137.254.60.11
Connecting to dev.mysql.com (dev.mysql.com)|137.254.60.11|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://repo.mysql.com//mysql57-community-release-el7-7.noarch.rpm [following]
--2016-02-03 18:36:04-- http://repo.mysql.com//mysql57-community-release-el7-7.noarch.rpm
Resolving repo.mysql.com (repo.mysql.com)... 104.102.164.25
Connecting to repo.mysql.com (repo.mysql.com)|104.102.164.25|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 8984 (8.8K) [application/x-redhat-package-manager]
Saving to: ‘mysql57-community-release-el7-7.noarch.rpm’
100%[=============================================================================================================================>] 8,984 --.-K/s in 0s
2016-02-03 18:36:07 (68.4 MB/s) - ‘mysql57-community-release-el7-7.noarch.rpm’ saved [8984/8984]
2、安装MySQL的Yum Repository
yum -y install mysql-community-server
3、启动数据库
systemctl start mysqld.service
然后使用命令systemctl status mysqld.service
查看MySQL数据库启动后的服务状态:
4、将其加入到开机启动
systemctl enable mysqld
5、配置mysql(修改密码等)
mysql_secure_installation
6、设置mysql用户
第一种:是直接将原来的 user='root' and host='localhost'
记录的host修改成%或指定的ip
1)将host设置为%表示任何ip都能连接mysql
update user set host='%' where user='root' and host='localhost';
2) 当然也可以将host指定为某个ip
3) 执行完以上语句,接着执行以下语句 ,刷新权限表,使配置生效
flush privileges;
第二种: 是新增一条记录方式
1)新增一个用户newname(这个新增的用户名称也可以为root)密码为并将host设置为%表示任何ip都能连接mysql
grant all on *.* to 'newname'@'%' identified by 'Navicat_123';
2)新增一个用户newname,密码为并将host设置为指定的ip 表示 只有该ip能连接mysql
grant all on *.* to 'newname'@'106.39.178.131' identified by 'Navicat_123';
3) 执行完以上语句,接着执行以下语句 ,刷新权限表,使配置生效
flush privileges;
当然如果想再改成本地的连接,只需要将对应用户的host改成localhost即可
7、修改阿里云安全组规则:
有一个安全组限制的设置,设置一下入方向可以允许3306端口
至此,即可采用mysql连接工具,诸如navicat,SQLyog等进行链接了。