How to retrieve Mysql users list?

Discussion in 'MySQL' started by Hitul, Mar 27, 2007.

  1. #1
    Hi. I want to retrieve Mysql users list. How to retrieve it? And where these users are stored?Please tell me.Thanks in advance.
     
    Hitul, Mar 27, 2007 IP
  2. ThreeGuineaWatch

    ThreeGuineaWatch Well-Known Member

    Messages:
    1,489
    Likes Received:
    69
    Best Answers:
    0
    Trophy Points:
    140
    #2
    select * from mysql.user;
    Code (markup):
    or just the name,

    select User from mysql.user;
    Code (markup):
    :)
     
    ThreeGuineaWatch, Mar 27, 2007 IP
  3. Hitul

    Hitul Peon

    Messages:
    76
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    and how to drop any user from the database?
     
    Hitul, Mar 28, 2007 IP
  4. saidev

    saidev Well-Known Member

    Messages:
    328
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    140
    #4
    delete from mysql.user WHERE User='name';

    replace name with the name of the user
     
    saidev, Mar 29, 2007 IP
  5. kishore99

    kishore99 Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Msg 156, Level 15, State 1, Line 1Incorrect syntax near the keyword 'user'.could any please guid me.
     
    kishore99, Jan 21, 2012 IP
  6. earnnet

    earnnet Member

    Messages:
    100
    Likes Received:
    0
    Best Answers:
    1
    Trophy Points:
    26
    #6
    possibilities: you didn't put the username in ' ' OR database with name 'mysql' doesn't exists OR forgot one ' or " or } or ] sign. It can be anything. echo your exact query and you'll know more.
    Before the mysql_query()! In other case you'll get Resource id#n message.
     
    earnnet, Jan 30, 2012 IP