Results 1 to 7 of 7

Thread: Mysql users

  1. #1
    Join Date
    Mar 2008
    Posts
    263

    Mysql users

    How can see mysql users and how can change password for a user.
    For example www_user (mysql user) in shell access?
    Need More Power?!
    PersianWhois.Com

  2. #2
    Join Date
    May 2006
    Location
    EU & USA
    Posts
    3,684
    To change the mysql user password (when having root access):

    Code:
    # mysql -u root -p
    mysql> SET PASSWORD FOR 'user'@'hostname' = PASSWORD('newpassword');
    mysql> flush privileges;
    Of course change the newpassword in what you want to use.
    cPanel Servers in Europe: Strasbourg (FR), Haarlem & Amsterdam (NL) & Kent (UK), USA (Los Angeles, St.Louis), Asia (Singapore) | Follow us at Twitter: @040hosting
    Shared | Reseller | (managed) Dedicated Hosting | Domain Registrar | SSL Registrar | Cloudlinux Partner| 040Hosting (Registered company #17093425 KVK Eindhoven, The Netherlands)

  3. #3
    Join Date
    Mar 2009
    Posts
    83
    You can also do

    # mysql -uroot -ppassword mysql
    mysql> select * from user;
    mysql> update user set password=password('newpass') where user='www_user';
    mysql> flush privileges;

  4. #4
    Join Date
    May 2006
    Location
    EU & USA
    Posts
    3,684
    To find all users;

    Code:
    # mysql -u root -p
    mysql> SELECT User from mysql.user;
    Hope this helps
    cPanel Servers in Europe: Strasbourg (FR), Haarlem & Amsterdam (NL) & Kent (UK), USA (Los Angeles, St.Louis), Asia (Singapore) | Follow us at Twitter: @040hosting
    Shared | Reseller | (managed) Dedicated Hosting | Domain Registrar | SSL Registrar | Cloudlinux Partner| 040Hosting (Registered company #17093425 KVK Eindhoven, The Netherlands)

  5. #5
    Join Date
    Jun 2009
    Posts
    30
    When setting database privileges, mind that underscore (_) is a special character, which has a meaing like dot (.) in regular expressions.

    GRANT ALL ON `db_name`... grants access to many databases, but
    GRANT ALL ON `db\_name`... grants access to single database named "db_name".

    b.

  6. #6
    Join Date
    Mar 2009
    Posts
    83
    Great tip on the _, I did not know that. Strange how cpanel traps that out on the database name but on the username field in the mysql database.

  7. #7
    Join Date
    Jun 2009
    Posts
    30
    I think it only applies to database names, not usernames.

    b.

Similar Threads

  1. MySQL users
    By Arshak23 in forum Programming Discussion
    Replies: 5
    Last Post: 05-12-2009, 01:56 PM
  2. Mysql too many users?
    By IMeanWebHosting in forum Hosting Security and Technology
    Replies: 4
    Last Post: 02-14-2005, 04:32 AM
  3. mysql and users
    By joshlink01 in forum Hosting Software and Control Panels
    Replies: 0
    Last Post: 05-08-2004, 08:14 AM
  4. Cpanel - MySQL users
    By AlaskanWolf in forum Hosting Security and Technology
    Replies: 4
    Last Post: 04-01-2004, 08:23 AM
  5. Mysql-users on CP3/WHM
    By smilb in forum Hosting Security and Technology
    Replies: 2
    Last Post: 07-25-2001, 10:05 PM

Posting Permissions

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