Skip to content
Search

MySql:Grant

lastmod 2018-09-13created 2018-09-131 edits

How to use the GRANT statement in MySQL.

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
Privilege setting.
  • all, for all privileges
  • Otherwise, you can selectively list select, update, delete, insert..., etc.
DB
Accessible db.
  • For all DBs, enter *.
TABLE
Accessible table.
  • For all tables, enter *.
ID
ID to add.
ADDRESS
Address allowed to connect.
  • To apply to all addresses, enter %. To apply to local only, enter localhost.
PASSWORD
Password
  • Must be written between ' and '. (ex: '1234')

Warning

To apply the changes, you must restart the DB or enter flush privileges;.

See also

author Zer0 sitemap