+ Reply to Thread
Results 1 to 5 of 5

Thread: giving a mysql user read only privileges

  1. #1
    Join Date
    Mar 2007
    Location
    Northampton, MA
    Posts
    622

    Question giving a mysql user read only privileges

    Hi can anyone let now how I can give a mysql user read only privileges to a database?

    The priveleges system is confusing to me.

    I am using navicat and these are the options:

    Select_priv
    Insert_priv
    Update_priv
    Delete_priv
    Create_priv
    Dropp_priv
    Grant_priv
    References_priv
    Index_priv
    Alter_priv
    Create_tmp_table_priv
    Lock_tables_priv
    Create_view_priv
    Show_view_priv
    Create_routine_priv
    Alter_routine_priv
    Execute_priv
    Last edited by Petrus4; 10-26-2007 at 04:25 PM.
    Deki Wiki 10
    UBUNTU 10.04 LTS

  2. #2
    Join Date
    Apr 2007
    Posts
    63

    Default

    Something that may help, but something you have to be very careful with, is setting up MYSQL Administrator, connecting to the database and then doing stuff that you want though a gui.

    The trick is that you need to edit /etc/mysql/my.cnf and "/etc/init.d/mysql restart" with the following parameters.

    Code:
    # Instead of skip-networking the default is now to listen only on
    # localhost which is more compatible and is not less secure.
    #bind-address           = 127.0.0.1
    bind-address            = 0.0.0.0
    My understanding is this should not be done on an insecure network as it will mean anyone can connect to your database. If you are behind a firewall it should be OK.

  3. #3
    Join Date
    Mar 2007
    Location
    Northampton, MA
    Posts
    622

    Default

    thanks internet scooter,

    what I am looking for is setting the priveleges for a mysql user.

    I want these to be read only. I think there must be mysql command to do this for a user.
    Deki Wiki 10
    UBUNTU 10.04 LTS

  4. #4
    Join Date
    Apr 2007
    Posts
    63

    Default

    OK here's what I think you might need to do...

    1. Connect to the database (in this case wikidb)

    Code:
    mysql --user=root -ppassword wikidb
    2. User "GRANT" to create your user and give it restricted access at the same time.

    Code:
    grant select on *.* to 'readonlyuser'@'localhost';
    See Adding New User Accounts to MySQL

  5. #5
    Join Date
    Mar 2007
    Location
    Northampton, MA
    Posts
    622

    Default

    Thanks! Iscooter
    Deki Wiki 10
    UBUNTU 10.04 LTS

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts