• Home
  • Technology
    • Ebullientech
    • Entrepreneurship
    • Video Technology
    • Cloud Computing
    • Business Analysis
  • Healthcare
    • Pharmacology
  • Thoughts
    • Food
    • General
    • Stories
    • Places
    • Workplace
    • Social Issues
    • Reviews
  • Quotes
  • Ebullientech News and Events
  • About

Kamalika's Notebook

thinking nothing...............!!

You are here: Home / Kamalika / Technology / MySQL / A Few Useful MySQL Commands / Queries for Amateur DBAs – Part 1

A Few Useful MySQL Commands / Queries for Amateur DBAs – Part 1

February 4, 2013 By Kamalika Leave a Comment

5. CREATE MySQL user and GRANT PRIVILEGES

Login as root user using putty and, login to MySQL as a root user as well.

Syntax:

mysql> CREATE USER ‘<username>’@'<available_for_ip_address>’ IDENTIFIED BY ‘<password>’;

mysql> GRANT ALL PRIVILEGES ON ‘<db_name>’.'<table_name>’  TO  ‘<username>’@'<available_for_ip_address>’ IDENTIFIED BY ‘<password>’;

Here “<available_for_ip_addresses>” can have value from ‘localhost’ to any qualified Public / Private IP address depending upon your requirement and if you want it to be available for all IPs just use “%” symbol.

Use a “*” symbol if you want to set the privileges for all the tables in a particular database.

User with GRANT ALL / full access:

mysql> CREATE USER ‘dbadmin’@’%’ IDENTIFIED BY ‘pwd@123’;

mysql> GRANT ALL PRIVILEGES ON db_mydb.* TO ‘dbadmin’@’%’ IDENTIFIED BY ‘pwd@123’;

mysql> FLUSH PRIVILEGES;

User with SELECT ONLY / limited access:

mysql> CREATE USER ‘dblimited’@’%’ IDENTIFIED BY ‘limit@123’;

mysql> GRANT SELECT ON db_mydb.* TO ”dblimited’@’%’ IDENTIFIED BY ‘limit@123’;

mysql> FLUSH PRIVILEGES;

When I started this post I thought I would be able to cover all the commands I have considered useful  so far but I figured one post is not enough. I’ll surely come back with more commands in the next part, till then let me know if you have any query / confusion via comments.

* Every command shared is executed using MySQL installed on any Linux distribution and every Query shared is executed from MySQL Query Browser GUI Tool

© Kamalika Guha Roy

Pages: 1 2 3 4

Filed Under: MySQL, Server Administration Tagged With: MySQL, MySQL Commands, MySQL Queries

« How to rename a stored procedure in MySQL?
Load Balanced Databases hosted in Cloud, MySQL ORDER BY and PHP Array Multi Sort! »

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Connect with Facebook

Let’s connect…

  • Facebook
  • Instagram
  • LinkedIn
  • Twitter
  • YouTube

Hello There…

I'm Kamalika, a techpreneur & startup mentor, blogger, hobbyist photographer, Netflix & Kindle indulgent, food connoisseur, Starbucks aficionado and former Disney employee ...next

Looking for something?

Tags

All in One SEO Pack AWS Banaras Blogger Blogging Blogs Dasaswamedh Ghat Ebullientech Ebullientech Interactive LLP Facebook Facebook Developers father's day father's day wishes father's day wishes for dad fathers day love Fathers Day Special Fathers Day wishes from daughter Father’s day memories GeoTech GeoTech Informatics HipHop for PHP Kamalika Guha Roy Kashi Ganga LAMP MySQL Nabaneeta Guha Roy Online Marketing PayPal PayPal's suspension of Indian bank transactions PHP PHP & MySQL Saraswati Puja Search Engine Optimization SEO Startup The Ganges TypePad UCO HUT Varanasi Web 2.0 Web 2.0 Design Web Design Web Marketing WordPress WordPress.COM

Timeline

  • 2024 (1)
  • 2021 (3)
  • 2020 (7)
  • 2019 (4)
  • 2018 (1)
  • 2015 (6)
  • 2014 (13)
  • 2013 (9)
  • 2010 (7)
  • 2009 (2)

Topics

Copyright © 2021 · Kamalika Guha Roy, Powered by: Ebullientech