In MySQL you can use the GRANT statement to create users and assign privileges to them at the same time. mysql을 부여하실 수있습니다 성명을 사용하여 사용자와 만들기를 동시에 그들에게 권한을 할당합니다. It is extremely convenient and beats create user or directly hacking the mysql.user table. 그것은 매우 편리하며 사용자 또는 직접 해킹 비트 mysql.user 테이블을 생성합니다. I learned few things about GRANT the hard way. 어려운 방법에 대한 몇 가지 경험에서 배운 점을 부여합니다.

MySQL allows you to create users associated with a particular host name or a set of host names. mysql과 관련된을 사용하면 사용자가 특정 호스트 이름을 작성 또는 일련의 호스트 이름을합니다. This allows you to easily restrict your user account to a particular host or a small set of allowed hosts. 이것을 사용하면 사용자 계정에 손쉽게 제한할 수있습니다를 특정 호스트 또는 호스트 작은 집합을 허용합니다.
A mysql user is identified not only by the user name but also by the host name. 뿐만 아니라 a mysql 사용자는 사용자에 의해 식별하는 이름을뿐만 아니라 호스트 이름을합니다. So, for example, you can have separate privileges for user foo connecting from host bar and for user foo connecting from localhost. 그래서, 예를 들어, 사용자에 대한 권한을하실 수있습니다 foo는 별도의 사용자에 대한 연결 foo 호스트 바, 로컬 호스트에서 연결합니다.

It is a good policy to allow the least amount of security as you can do with. 를 허용하는 그것은 좋은 정책을 수행할 수있는 최소한의 경비로합니다. It is better to add privileges as needed as opposed to providing blanket privileges upfront. 권한을 추가할 것이 좋다 담요를 제공하기 위해 필요에 따라 권한이 반대로 upfront합니다.

A typical GRANT statement to GRANT all privileges to all tables on database db to user tim with password pass connecting from machine jaguar can be written as follows: 모든 권한을 부여합니다 성명을 부여하는 전형적인 데이터베이스에서 모든 테이블과 비밀 번호를 통과 팀 데시벨을 사용자 컴퓨터에 연결 재규어에서 다음과 같이 작성할 수있습니다 :
grant all on db.* to ‘ tim ‘@’ jaguar ‘ identified by ‘ pass ‘; 부여합니다 .* dB 모두를 '팀'@ '재규어'에 의해 식별 '합격';

To allows tim to connect only from localhost (same machine as the database) change it as follows: 로컬 호스트를 통해서만 연결할 수 팀 (동일 머신으로 데이터베이스)를 다음과 같이 변경합니다 :
grant all on db.* to ‘ tim ‘@’ localhost ‘ identified by ‘ pass ‘; 부여합니다 .* dB 모두를 '팀'@ '로컬'에 의해 식별 '합격';

To allows tim to connect only from any machine change it as follows: 어떤 기계를 통해서만 연결할 수 팀 다음과 같이 변경합니다 :
grant all on db.* to ‘ tim ‘@’ % ‘ identified by ‘ pass ‘; 부여합니다 .* dB 모두를 '팀'@ '%'에 의해 식별 '합격';

To restrict tim connecting from localhost to only select & insert privilege in db database use: 로컬 호스트에서 접속을 제한할 팀에 삽입 권한만을 선택 & dB 데이터베이스를 사용 분야 :
grant select, insert on db.* to ‘ tim ‘@’ localhost ‘ identified by ‘ pass ‘; 그랜트를 선택, 삽입을 dB .*를 '팀'@ '로컬'에 의해 식별 '합격';

Reference: 참조 : MySQL Manual mysql 매뉴얼

The full syntax for GRANT is: 의 전체 구문을 부여합니다 :

GRANT priv_type [(column_list)] [, priv_type [(column_list)]] … 그랜트 priv_type [(column_list)] [, priv_type [(column_list)]]…
ON [object_type] {tbl_name | * | *.* | db_name.*} 를 [object_type] (tbl_name | * | *.* | db_name .*)
TO user [IDENTIFIED BY [PASSWORD] ‘password’] 이 사용자 [식별되는 [비밀 번호] '비밀 번호']
[, user [IDENTIFIED BY [PASSWORD] ‘password’]] … [, 사용자 [식별되는 [비밀 번호] '비밀 번호']…
[REQUIRE [이 필요
NONE | 없음 |
[{SSL| X509}] [(ssl | x509)]
[CIPHER 'cipher' [AND]] [암호 '암호'[및]
[ISSUER 'issuer' [AND]] [발급자 '발행자'[및]
[SUBJECT 'subject']] [제목 : '제목 :']
[WITH with_option [with_option] …] [과 with_option [with_option]…]

object_type = object_type =
TABLE 탁자
| FUNCTION | 함수
| PROCEDURE | 프로 시저

with_option = with_option =
GRANT OPTION 옵션을 부여합니다
| MAX_QUERIES_PER_HOUR count | max_queries_per_hour 카운트
| MAX_UPDATES_PER_HOUR count | max_updates_per_hour 카운트
| MAX_CONNECTIONS_PER_HOUR count | max_connections_per_hour 카운트
| MAX_USER_CONNECTIONS count | max_user_connections 카운트