개발/DB

MariaDB 계정 생성 및 권한 설정

yunzema 2019. 5. 21. 14:15
반응형

1. 계정 생성

 

1-1. 내부 접속 계정

  create user 'RemoteUser'@'localhost' identified by '$YourPassword';

 

1-2. 모든 IP 외부접속 계정

  create user 'RemoteUser'@'%' identified by '$YourPassword';

 

1-3. 특정 IP 외부접속 계정

  create user 'RemoteUser'@'192.168.2.%' identified by '$YourPassword';

 

 

2. 권한 설정

 

2-1. 내부 접속 계정에 권한 부여

 grant all privileges on DB_NAME.* to RemoteUser@'localhost';

 

2-2. 모든 IP 외부 접속 계정에 권한 부여

 grant all privileges on DB_NAME.* to RemotUser@'%';

 

2-3. 특정 IP 외부 접속 계정에 권한 부여

 grant all privileges on DB_NAME.* to RemoteUser@'192.168.2.%';