겉바속촉

DBMS 7. MYSQL host가 뭐야? 본문

IT 일기 (상반기)/주요정보통신기반시설

DBMS 7. MYSQL host가 뭐야?

겉바속촉 2021. 12. 8. 13:27
728x90
반응형

 

스키마를 mysql로 변경

 

mysql> use mysql
Database changed

 

 

host, user 정보 확인하기

 

mysql> select host, user, authentication_string from user;
+-----------+------------------+------------------------------------------------------------------------+
| host      | user             | authentication_string                                                  |
+-----------+------------------+------------------------------------------------------------------------+
| localhost | debian-sys-maint | $A$005$4%
                                          qt>aFM	Q+Xl'EOLK67oB6sAnqkicZJegafwTMAliEqbhEOMSu3PtSsS6 |
| localhost | juu              | $A$005$v2oz,lR_m8cfpZWdRqM3HXrxOASCsA8mi.erFAtw8u6Rr8mQ1EUsSUE8 |
| localhost | mysql.infoschema | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
| localhost | mysql.session    | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
| localhost | mysql.sys        | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
| localhost | root             |                                                                        |
| localhost | test             | $A$005$n
m;Xo0wX|X80xVP71nlcZFuXKS904s9PfMdfeSKPRwbmUVG43p8ujQB |
0.rQYVyjIAdDsrLFrHRrGxjPqghPWgKzYYtJxyt2kN3 |7Nkx%VYoE2N
+-----------+------------------+------------------------------------------------------------------------+
8 rows in set (0.00 sec)

 

 

host 종류는 localhost와 % 이렇게 나뉨

 

기본적으로 MySQL을 설치하면

로컬(localhost)에서만 접속이 가능하고 외부에서는 접속이 불가능

 

그래서 host가 %인 user를 추가해서 조회해보면 다음과 같이 나옴

mysql> 
mysql> create user 'master'@'%' identified by 'masterpass';
Query OK, 0 rows affected (0.02 sec)

mysql> select host, user, authentication_string from user;
+-----------+------------------+------------------------------------------------------------------------+
| host      | user             | authentication_string                                                  |
+-----------+------------------+------------------------------------------------------------------------+
| %         | master           | $A$005$7q{)JZZfPiNvyLbmduP7VVQ4w6ypbDU81wgrV98RaGR4ce8hSv6 |
| localhost | debian-sys-maint | $A$005$4%qt>aFMQ+Xl'EOLK67oB6sAnqkicZJegafwTMAliEqbhEOMSu3PtSsS|
+-----------+------------------+----------------------------------------------------------------

 

 

그리고 다시 계정 삭제해주기

 

 

삭제해주지 않으면 취약하기 때문에~ (✿◡‿◡)

728x90
반응형