Skip to content

MySql:Grant

MySQL의 GRANT문 사용방법.

Syntax

grant [AUTHORITY] privileges on [DB].[TABLE] to [ID]@[ADDRESS] identified by [PASSWORD] with grant option;

Example

grant all privileges on *.* to id@localhost identified by '1234' with grant option;

Param

Authority
권한 설정.
  • 모든권한일 경우 all
  • 그 밖에 select, update, delete, insert... 등 선택적으로 적을 수 있다.
DB
접근 가능 db.
  • 모든 DB일 경우 *를 입력하면 된다.
TABLE
접근 가능 table.
  • 모든 table일 경우 *를 입력하면 된다.
ID
추가 ID.
ADDRESS
접속 가능 주소.
  • 모든 주소에 적용하려면 %로 입력하면 된다. 로컬에만 적용하기 위해서는 localhost로 입력하면 된다.
PASSWORD
암호
  • ''사이에 적어줘야 한다. (ex: '1234')

Warning

적용을 위하여 DB를 재가동 하거나 flush privileges;를 입력해야 한다.

See also