Skip to main content

How to Grant Privilages to an account in MYSQL

MYSQL 'GRANT' statement allows you to grant access privileges to database account.

To achieve same ,syntax  is as follow:

Syntax:-

GRANT privileges [Column_List]
ON  [Object_Type]
Privilege_level
To account [IDENTIFIED BY 'password']
[REQUIRE encryption]
WITH with_option ;

Detailed explanation:

Privileges:- It indicates that you have assign privileges to account.

column_List :- (1) Its  optional.
                         (2) Column(s) to which privileges apply.

Privileges_level :- Level at which privileges apply.

You can use global  privileges,database privileges,table specific privileges, column privileges etc.

Account :- Which  account is being granted privileges.

Password:- Specifies password.It replace old password.

Required:- Clause specify whether the account has to connect to database server over secure connection SSL.

* If you want the account to have privilege that can grant its own privileges to over other account ,you need to use WITH clause with the grant OPTION clause.

Examples:

(a) If you want to create super account that can do anythings
   
    CREATE USER 'super'@'localhost' IDENTIFIED BY 'super123' ;

  GRANT ALL ON *.* TO 'super'@'localhost'  WITH GRANT OPTION ;

Note :-*.* clause  means all database and all object in database.

(b) GRANT select,update,delete ON classic.* TO 'testuser'@' %' ;

  Here classic is database name &  testuser is user name. % mean access from all .


 

Comments

Popular posts from this blog

Hyderabad may become India‘s first fully Wi-Fi-enabled city

 In a bid to make Hyderabad the first fully Wi-Fi-enabled metro in the country, Telangana government is holding talks with various telecom service providers to offer the services.  The state's information technology minister KT Rama Rao told reporters here that steps are being taken to offer Wi-Fi services across greater Hyderabad metropolitan area. "We are taking a leaf out of cities like Mountain View and Houston for offering Wi-Fi services. We are speaking to service providers," he said, adding that they are also looking at Ahmedabad and Bangalore where Wi-Fi services are available on a limited basis.  source:techgig

EXAM PATTERN for the upcoming CCC exam?

      EXAM PATTERN  for the upcoming CCC exam?     • The examination conducted will be in objective form. • There will be 100 questions and time given will be 90minutes so the candidates have 90 minutes to solve multiple choice questions. • The result will not come in the form of marks it will in grades and certificate will be given to the candidates scoring minimum 50%. • This exam is done every month so no qualification is needed. • Candidates will have to go through the online tests this will actually help the housewives and the person who wants some basic knowledge.