Find the answer to your Linux question:
Results 1 to 6 of 6
Hi. I have a MySQL server running, but do not have PHPMyAdmin installed (and want to keep it like that for the mean time). Within MySQL, i have a database ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Guru
    Join Date
    Apr 2003
    Location
    London, UK
    Posts
    3,284

    Create MySQL Users?


    Hi.

    I have a MySQL server running, but do not have PHPMyAdmin installed (and want to keep it like that for the mean time).

    Within MySQL, i have a database named "backenddb".

    I access MySQL using the Linux Comand Line mysql utility.

    How do i add a mysql user the ability to login and work within the backenddb database only? - using the command line utility?

    Cheers,

    Jason

  2. #2
    flw
    flw is offline
    Linux Engineer
    Join Date
    Mar 2003
    Location
    U.S.A.
    Posts
    1,025
    Followup question is doesn't cron run as root? If so then you can run a script via cron or am I nuts or is it a bananna?
    Dan

    \"Keep your friends close and your enemies even closer\" from The Art of War by Sun Tzu\"

  3. #3
    Just Joined!
    Join Date
    Mar 2003
    Location
    UK
    Posts
    82
    This would add the user 'newuser' with the password 'thepassword' and then give the user access to backenddb from any host with privelages to select, insert, update, delete, create and drop. Its not amazingly hard to userstand the bulk of it. So you'll be able to change anything you want or don't want quite easily.

    This will need to be done as the root mysql user.

    Code:
    mysql> use mysql;
    mysql> insert into 
             -> user (host, user, password)
             -> values('%','newuser',password('thepassword'));
    mysql> insert into
          -> db (host,db,user,Select_priv, Insert_priv, Update_priv, Delete_priv, Create_priv, Drop_priv)
          -> values ('%','backenddb','newuser','Y','Y','Y','Y','Y','Y');
    mysql> quit

    Ive never used the linux mysql util, but I am familer with mysql, and it all looks right from what I've learnt.

    hope thats what you ment.

  4. $spacer_open
    $spacer_close
  5. #4
    Linux Guru
    Join Date
    Apr 2003
    Location
    London, UK
    Posts
    3,284
    yes that is what i ment, only problem is i cannot login with my newly created user, even if i specify the username, password, and the database to use as command line switches.

    transcript of session:
    Code:
    root@london:/data/web/this_site_does_not_exist# mysql -u phpbb -p --database=backenddb
    Enter password:
    ERROR 1045: Access denied for user: 'phpbb@localhost' (Using password: YES)
    root@london:/data/web/this_site_does_not_exist#
    any ideas?

  6. #5
    flw
    flw is offline
    Linux Engineer
    Join Date
    Mar 2003
    Location
    U.S.A.
    Posts
    1,025
    Checkout http://www.experts-exchange.com/Data..._10516859.html threads may help or not. Just a idea.
    Dan

    \"Keep your friends close and your enemies even closer\" from The Art of War by Sun Tzu\"

  7. #6
    Just Joined!
    Join Date
    Aug 2003
    Posts
    5

    Re: Create MySQL Users?

    Quote Originally Posted by Jaguar
    Hi.

    I have a MySQL server running, but do not have PHPMyAdmin installed (and want to keep it like that for the mean time).

    Within MySQL, i have a database named "backenddb".

    I access MySQL using the Linux Comand Line mysql utility.

    How do i add a mysql user the ability to login and work within the backenddb database only? - using the command line utility?

    Cheers,

    Jason
    mysql> grant all privileges on backenddb.* to newuser@localhost identified by 'password' ;

Posting Permissions

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