码迷,mamicode.com
首页 > 数据库 > 详细

CentOS 7 安装MySql Server 5.6

时间:2016-08-29 09:06:45      阅读:141      评论:0      收藏:0      [点我收藏+]

标签:

1. 安装MySql Server

在/etc/yum.repos.d/目录下添加以下文件mysql-community.repo文件,内容如下:

1 [mysql56-community]
2 name=MySQL 5.6 Community Server
3 baseurl=http://repo.mysql.com/yum/mysql-5.6-community/el/5/$basearch/
4 enabled=1
5 gpgcheck=0

     执行yum install mysql-community-server即可。

     启动服务 # service mysqld start

2 .设置密码

 1 [root@yl-web yl]# mysql -u root 
 2 Welcome to the MySQL monitor.  Commands end with ; or \g.
 3 Your MySQL connection id is 3
 4 Server version: 5.6.26 MySQL Community Server (GPL)
 5 
 6 Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
 7 
 8 Oracle is a registered trademark of Oracle Corporation and/or its
 9 affiliates. Other names may be trademarks of their respective
10 owners.
11 
12 Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.
13 
14 mysql> set password for ‘root‘@‘localhost‘ =password(‘password‘);

3. 远程连接设置

把在所有数据库的所有表的所有权限赋值给位于所有IP地址的root用户。

mysql> grant all privileges on *.* to root@‘%‘identified by ‘password‘;

如果是新用户而不是root,则要先新建用户

mysql>create user ‘username‘@‘%‘ identified by ‘password‘;  

4  .将firewall关闭:

[root@gradven ~]# systemctl stop firewalld.service #停止firewall
[root@gradven ~]# systemctl disable firewalld.service #禁止firewall开机启动
最后reboot电脑 

此时就可以进行远程连接了。

CentOS 7 安装MySql Server 5.6

标签:

原文地址:http://www.cnblogs.com/ztb123/p/5815289.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!