Granting privileges or account permissions are used by MYSQL to specify who can do what. Permissions can be granted for particular databases, tables or columns. For developers and database administrator who uses the command prompt, this article will help you to do this MySQL command line.


green stickman on restoring mysql dump

To grant a privilege, use the following procedures and notes (This guide is for Windows OS):
1.) Open the command prompt.
2.) Access the MySQL database by typing: mysql -u [username] – p
(You will be prompted by a password.)
3.) Then type the following:

GRANT [PERMISSION] ON [TABLE NAME/DATABASE NAME] TO ‘[ACCOUNT NAME]‘@[HOSTNAME] IDENTIFIED BY ‘[PASSWORD]‘;

Example:
GRANT ALL PRIVILEGES ON TestDb.* TO ‘greenstickman’@localhost IDENTIFIED BY ‘pA55w0rd’;

4.) If query is OK, type the following to refresh the database:

FLUSH PRIVILEGES

There are lots of permissions available aside from ALL permission.
:)


Is this post helpful? If it does, please help me to publish quality articles like this. Send some TIPS to keep this website alive by clicking the paypal button or sending Bitcoins to BTC address below:
paypalbtc
3HwMMYfNSWYSCa7fPtBoWKtW8mt9i6cpoe
btc
Click the QR Code or text above to copy the BTC Address.


OR better if you could support this website by buying my book (This is available both on paperback and e-book version)! A true Green Stickman avid reader would definitely have this one. Limited copies only for the paperback! So make sure to grab your copy.