Page 1 of 2 12 LastLast
Results 1 to 15 of 22
  1. #1
    Join Date
    Jul 2006
    Posts
    11

    Unanswered: how to enable/disable a user account in MYSQL

    hi


    i have a requirement that i have to enable/disable a user account in MYSQL progrmatically.do we have any command for this ???

    thanks in advance
    Ramana

  2. #2
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    161
    I doubt if this is possible directly, but you can use GRANT to set permissions to which tables the user has access to, limiting resources or changing the password.
    MySQL 5.1

  3. #3
    Join Date
    Jul 2006
    Posts
    11

    regarding enabling/disabling a user in MY SQL

    hi anjanesh

    first of all thanks a lot for replying my thread.


    as you said i tried ..but efforts went in vain

    this is how i tried:

    GRANT ALL ON *.* TO david;//assumeing user is "david"

    REVOKE ALL PRIVILEGES ON *.* FROM david;

    after giveing the above REVOKE COMMAND .when i tries to login with
    mysql -u david -ppassword

    it is allowing me to login.since REVOKE is applied on david user he should not allow david to login.

    please help me in this regard...if you find any command pls send me


    thanks in advance
    Ramana

  4. #4
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    161
    Do FLUSH PRIVILEGES; after every GRANT or REVOKE.
    MySQL 5.1

  5. #5
    Join Date
    Jul 2006
    Posts
    11

    reg enable/disable issue

    hi anjanesh

    i tried with FLUSH PRIVILEGES also
    but no luck..

    if you find any other solution pls let me know

    thanks in advance
    Ramana

  6. #6
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    161
    Actually, the full username path should be 'username'@'hostname'

    If the hostname of david is localhost then try
    Code:
    REVOKE ALL PRIVILEGES ON *.* FROM 'david'@'localhost';
    MySQL 5.1

  7. #7
    Join Date
    Jul 2006
    Posts
    11
    hi

    i tried with what ever the command u sent just now


    i tried with this command::::REVOKE ALL PRIVILEGES ON *.* FROM 'david'@'localhost';

    this is the error i am getting...

    mysql> REVOKE ALL PRIVILEGES ON *.* FROM 'david'@'localhost';
    ERROR 1141 (42000): There is no such grant defined for user 'david' on host 'localhost'

    thanks
    Ramana

  8. #8
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    161
    Ok. Lets see the data directly from the mysql table.
    Login as root
    Code:
    USE mysql;
    SELECT `Host`, `User`, `Password` FROM `user`;
    What do you get ?
    MySQL 5.1

  9. #9
    Join Date
    Jul 2006
    Posts
    11

    enable/disable probelm

    hi

    when i use this command:

    SELECT `Host`, `User`, `Password` FROM `user`;

    this is the error i am getting

    ERROR 1046 (3D000): No database selected

  10. #10
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    161
    USE mysql;

    And I hope you are using mysql command line - if not what client are you using ? In what are you executing queries ?
    MySQL 5.1

  11. #11
    Join Date
    Jul 2006
    Posts
    11
    hi

    yeah you are right i am useing MYSQL Command Prompt.

    i tried with SQLYog also....

    but no result.
    thanks
    Ramana

  12. #12
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    161
    Whats the result of DESCRIBE `user` ?
    MySQL 5.1

  13. #13
    Join Date
    Jul 2006
    Posts
    11
    hi

    COMMAND ESCRIBE `user`
    this is the result

    ERROR 1046 (3D000): No database selected

    thanks

  14. #14
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    161
    To select the database type
    USE mysql;
    MySQL 5.1

  15. #15
    Join Date
    Jul 2006
    Posts
    11

    enable/disable

    hi

    when i typed :
    mysql> use mysql database;
    Database changed

    after that when i type

    mysql> DESCRIBE `user`;
    +-----------------------+-----------------------------------+------+-----+-----
    ---+-------+
    | Field | Type | Null | Key | Defa
    lt | Extra |
    +-----------------------+-----------------------------------+------+-----+-----
    ---+-------+
    | Host | char(60) | NO | PRI |
    | |
    | User | char(16) | NO | PRI |
    | |
    | Password | char(41) | NO | |
    | |
    | Select_priv | enum('N','Y') | NO | | N
    | |
    | Insert_priv | enum('N','Y') | NO | | N
    | |
    | Update_priv | enum('N','Y') | NO | | N
    | |
    | Delete_priv | enum('N','Y') | NO | | N
    | |
    | Create_priv | enum('N','Y') | NO | | N
    | |
    | Drop_priv | enum('N','Y') | NO | | N
    | |
    | Reload_priv | enum('N','Y') | NO | | N
    | |
    | Shutdown_priv | enum('N','Y') | NO | | N
    | |
    | Process_priv | enum('N','Y') | NO | | N
    | |
    | File_priv | enum('N','Y') | NO | | N
    | |
    | Grant_priv | enum('N','Y') | NO | | N
    | |
    | References_priv | enum('N','Y') | NO | | N
    | |
    | Index_priv | enum('N','Y') | NO | | N
    | |
    | Alter_priv | enum('N','Y') | NO | | N
    | |
    | Show_db_priv | enum('N','Y') | NO | | N
    | |
    | Super_priv | enum('N','Y') | NO | | N
    | |
    | Create_tmp_table_priv | enum('N','Y') | NO | | N
    | |
    | Lock_tables_priv | enum('N','Y') | NO | | N
    | |
    | Execute_priv | enum('N','Y') | NO | | N
    | |
    | Repl_slave_priv | enum('N','Y') | NO | | N
    | |
    | Repl_client_priv | enum('N','Y') | NO | | N
    | |
    | Create_view_priv | enum('N','Y') | NO | | N
    | |
    | Show_view_priv | enum('N','Y') | NO | | N
    | |
    | Create_routine_priv | enum('N','Y') | NO | | N
    | |
    | Alter_routine_priv | enum('N','Y') | NO | | N
    | |
    | Create_user_priv | enum('N','Y') | NO | | N
    | |
    | ssl_type | enum('','ANY','X509','SPECIFIED') | NO | |
    | |
    | ssl_cipher | blob | NO | |
    | |
    | x509_issuer | blob | NO | |
    | |
    | x509_subject | blob | NO | |
    | |
    | max_questions | int(11) unsigned | NO | | 0
    | |
    | max_updates | int(11) unsigned | NO | | 0
    | |
    | max_connections | int(11) unsigned | NO | | 0
    | |
    | max_user_connections | int(11) unsigned | NO | | 0
    | |
    +-----------------------+-----------------------------------+------+-----+-----
    ---+-------+
    37 rows in set (0.00 sec)



    this is the result.

    thanks

Posting Permissions

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