The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Create mysql user for all accounts

Discussion in 'Database Discussions' started by gpa, Aug 25, 2011.

  1. gpa

    gpa Member

    Joined:
    Feb 15, 2010
    Messages:
    14
    Likes Received:
    0
    Trophy Points:
    1
    Hi...

    How do I create a user with access to all databases, in all accounts (ie same privileges as root@localhost)...

    I only seem to be able to create users in cpanel for a given account, not in phpmyadmin in WHM. Users created in a accounts cpanel seem to be unable to be given access to all databases...

    Thanks

    Dave.
     
  2. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    Hello Dave,

    This would create a user similar to root called myadmin that has the same privileges root user has:

    You would do this in MySQL command line in root SSH:

    Code:
    mysql
    After in MySQL CLI, then you can run the above. You could then change that user's password afterward in WHM > SQL Services > Change MySQL User Password area.

    Please note that this was tested in MySQL 5.0.92 on my machine. Please also note that this user will function similar to root in that the user does not appear in the individual cPanel accounts, since that user cannot be dropped as an existing user by any of those accounts.
     
  3. gpa

    gpa Member

    Joined:
    Feb 15, 2010
    Messages:
    14
    Likes Received:
    0
    Trophy Points:
    1
    Great - many thanks.. That looks just the job!

    Dave
     
  4. gpa

    gpa Member

    Joined:
    Feb 15, 2010
    Messages:
    14
    Likes Received:
    0
    Trophy Points:
    1
    Worked perfectly - thanks again!

    Dave
     
  5. jdv

    jdv Registered

    Joined:
    Nov 19, 2006
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Hi,

    Thanks for this, but when I try to run the above in MySQL CLI, I cannot get the command to execute. There is a ';' at the end, but when I hit enter I get only a new prompt ( '>). I tried \g also but the same result. What am I doing wrong?

    Server version: 5.1.65-cll MySQL Community Server (GPL)

    Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.

    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

    mysql> INSERT INTO `mysql`.`user` (
    -> `Host` ,
    -> `User` ,
    -> `Password` ,
    -> `Select_priv` ,
    -> `Insert_priv` ,
    -> `Update_priv` ,
    -> `Delete_priv` ,
    -> `Create_priv` ,
    -> `Drop_priv` ,
    -> `Reload_priv` ,
    -> `Shutdown_priv` ,
    -> `Process_priv` ,
    -> `File_priv` ,
    -> `Grant_priv` ,
    -> `References_priv` ,
    -> `Index_priv` ,
    -> `Alter_priv` ,
    -> `Show_db_priv` ,
    -> `Super_priv` ,
    -> `Create_tmp_table_priv` ,
    -> `Lock_tables_priv` ,
    -> `Execute_priv` ,
    -> `Repl_slave_priv` ,
    -> `Repl_client_priv` ,
    -> `Create_view_priv` ,
    -> `Show_view_priv` ,
    -> `Create_routine_priv` ,
    -> `Alter_routine_priv` ,
    -> `Create_user_priv` ,
    -> `ssl_type` ,
    -> `max_questions` ,
    -> `max_updates` ,
    -> `max_connections` ,
    -> `max_user_connections`
    -> )
    -> VALUES (
    -> 'localhost',
    -> 'myadmin',
    -> PASSWORD
    -> ('5e56fd065010e196112dbf41f485d0cb5e56fd065010e196112dbf41f485d0cb''),
    '> 'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','0','0','0','0'
    '> );
    '>
     
Loading...

Share This Page