행위

"MYSQL 외부접속허용"의 두 판 사이의 차이

DB CAFE

(새 문서: == 1.root권한 으로 접속 == <source lang=sql> mysql> use mysql; mysql> select host, user, password from user; </source> == 2.권한 설정 하기 == 1) 특정 IP 접근 허용...)
 
 
(같은 사용자의 중간 판 3개는 보이지 않습니다)
9번째 줄: 9번째 줄:
 
1) 특정 IP 접근 허용 설정
 
1) 특정 IP 접근 허용 설정
 
<source lang=sql>
 
<source lang=sql>
mysql> grant all privileges on *.* to ‘root’@‘192.168.56.101’ identified by ‘root의 패스워드’;
+
mysql> grant all privileges on *.* to 'root'@'192.168.56.101' identified by '패스워드'’;
 
</source>
 
</source>
 
2) 특정 IP 대역 접근 허용 설정
 
2) 특정 IP 대역 접근 허용 설정
 
<source lang=sql>
 
<source lang=sql>
mysql> grant all privileges on *.* to ‘root’@‘192.168.%identified by ‘root의 패스워드’;
+
mysql> grant all privileges on *.* to 'root'@'192.168.%' identified by 'root의 패스워드';
 
</source>
 
</source>
 
3) 모든 IP의 접근 허용 설정
 
3) 모든 IP의 접근 허용 설정
 
<source lang=sql>
 
<source lang=sql>
mysql> grant all privileges on *.* to ‘root’@%identified by ‘root의 패스워드’
+
mysql> grant all privileges on *.* to 'root'@'%' identified by 'root의 패스워드';
 
</source>
 
</source>
  
== 3.등룩확인 후 적용 ==
+
== 3.변경사항 적용 ==
 
<source lang=sql>
 
<source lang=sql>
 
mysql> flush privileges;
 
mysql> flush privileges;
 
</source>
 
</source>
  
== 4. my.cnf 파일 변경  
+
== 4. my.cnf 파일 변경 ==
  
 
:bind-address 주석처리
 
:bind-address 주석처리
32번째 줄: 32번째 줄:
 
# bind-address = 127.0.0.1
 
# bind-address = 127.0.0.1
 
</source>
 
</source>
 +
 
== 5. mysql 재시작 ==
 
== 5. mysql 재시작 ==
 
<source lang=sql>
 
<source lang=sql>
 
/etc/init.d/mysqld restart
 
/etc/init.d/mysqld restart
 
</source>
 
</source>
 +
 +
[[Category:mysql]]

2019년 12월 18일 (수) 21:57 기준 최신판

thumb_up 추천메뉴 바로가기


1 1.root권한 으로 접속[편집]

mysql> use mysql;
mysql> select host, user, password from user;

2 2.권한 설정 하기[편집]

1) 특정 IP 접근 허용 설정

mysql> grant all privileges on *.* to 'root'@'192.168.56.101' identified by '패스워드'’;

2) 특정 IP 대역 접근 허용 설정

mysql> grant all privileges on *.* to 'root'@'192.168.%' identified by 'root의 패스워드';

3) 모든 IP의 접근 허용 설정

mysql> grant all privileges on *.* to 'root'@'%' identified by 'root의 패스워드';

3 3.변경사항 적용[편집]

mysql> flush privileges;

4 4. my.cnf 파일 변경[편집]

bind-address 주석처리
vi /etc/my.cnf
# bind-address = 127.0.0.1

5 5. mysql 재시작[편집]

/etc/init.d/mysqld restart