Mysql Access Privileges

  • Filter
  • Time
  • Show
Clear All
new posts

    Mysql Access Privileges

    A privilege in a database is the right that a user of the database has, so far as the database is concerned. For example, a user may have the right to select rows of a table, but not to delete any row in the table. In this article I introduce you to MySQL Access Privileges, then I give you the hyperlink to detail explanation.

    User Name and Password
    In order for a user to access the MySQL server in the first place, he needs to record a user name (single word) and password in the MySQL server. After this, he can only log into the database server; he cannot do anything else. He has to be given privileges before he can use the databases in the server. The user has his user name and password recorded with the server and not with any database.

    MySQL Account
    A MySQL account consists of a user name, password and privileges for one user.

    Some Privileges and Data Definition Statements
    Here is a list of some statements (and) privileges. The privilege for a statement allows the user to use the statement (on the item or object concerned).

    alter table - ALTER
    create database, create table - CREATE
    create temporary table - CREATE TEMPORARY
    drop database, drop table - DROP
    create trigger, drop trigger (table) - TRIGGER

    So in the above list, the privileges are: ALTER, CREATE, CREATE TEMPORARY, DROP. On the left of each privilege above, you have the statement or statements concerned.

    Some Privileges and Data Manipulation Statements
    Here is a list of some statements (and) privileges under data manipulation:

    delete (rows) - DELETE
    insert (rows) - INSERT
    select (columns) - SELECT
    update (table) - UPDATE

    Some Privileges and MySQL Transactional and Locking Statements
    Here is a list of some statements (and) privileges under Transaction and Locking:

    Lock tables - LOCK TABLES

    When a table is locked by a user, only that user can use the table at that time. You will see details later.

    Some Privileges and Database Administration Statements
    Here is a list of some statements (and) privileges under Database Administration:

    show databases - SHOW DATABASES
    create user - CREATE USER
    flush (table, log) - RELOAD

    The Root User
    In MySQL, the database administrator is called the root. The root has all the privileges in the MySQL server. He has all the privileges that the ordinary user has. The root is also a user. So the privileges of any other user is a sub set of root's privileges. The root is the one who gives (create) other users, their accounts.

    You probably have studied the basics of MySQL without worrying about the privileges. In that case you used the MySQL server as the root, with all privileges and you did not need to bother whether or not you were restricted from doing anything.

    When the ordinary user has an account, his privileges are granted to him by the root. The ordinary user can also grant his privileges to another user.

    There is more to MySQL access privileges than what I have given above. In fact I have already prepared a tutorial series on the topic, for you. The tutorials are free and have been written in a step-by-step fashion. The tutorials are well formatted (typed out) and there is no missing special character. Click the following hyperlink and start the series:

    Mysql Access Privileges