SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Zealot
    Join Date
    Dec 2000
    Location
    Ohio
    Posts
    150
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm opening a free web host soon and have decided to provide MySQL support. The database would be used mostly for setting up forums and banner rotators. The question is how to do this. I'm new to MySQL and don't have much experience. From what I gather (from a simple tutorial) it would go something like this:

    mysql -u root -p

    mysql> create database example;

    mysql> use example;

    mysql> grant usage
    on example
    to webuser@localhost;

    mysqladmin -u webuser oldpassword newpassword

    This should create a user named 'webuser' with the password 'newpassword'. His database should be named 'example' and located at 'localhost'.

    Now I most likely messed up somewhere, so if someone could point it out, I'd be thankful. Also, if anyone has a better way of a free web host supplying MySQL access to it's users let me know.
    <Edited by syanet on 01-16-2001 at 10:40 PM>

  2. #2
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you need to create the database from the command prompt not inside mysql

    $> mysql -u root -p create database test;

    Then do the rest as you suggested.
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  3. #3
    SitePoint Zealot
    Join Date
    Dec 2000
    Location
    Ohio
    Posts
    150
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here's where I'm stuck:

    (logged in as root)

    mysql> create database syanet;
    Query OK, 1 row affected (0.00 sec)

    mysql> use syanet;
    Database changed

    mysql> grant usage on syanet to jheiser@localhost;
    ERROR 1146: Table 'syanet.syanet' doesn't exist

    What is wrong?

  4. #4
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I prefer to modify the the use table and the db table instead of using grant privileges. Take a look at the user table and db tables it ieasier to manipulate the privileges that way, at least for me.
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  5. #5
    SitePoint Zealot
    Join Date
    Dec 2000
    Location
    Ohio
    Posts
    150
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Like this?

    mysql> insert into user (localhost,jheiser,password) values('localhost',jheiser','');

    I again just get a blank line after it .
    <Edited by syanet on 01-18-2001 at 12:21 AM>

  6. #6
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think you forgot a single quote before jheiser also you need to give your user the correct permissions also you either need to give your user full privileges or else add an entry to the db table giving him the appropriate rights for that db here is a sample of my user and db tables;

    +-----------+-------+------------------+-------------+-------------+------------
    -+-------------+-------------+-----------+-------------+---------------+--------
    ------+-----------+------------+-----------------+------------+------------+
    | 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 |
    +-----------+-------+------------------+-------------+-------------+------------
    -+-------------+-------------+-----------+-------------+---------------+--------
    ------+-----------+------------+-----------------+------------+------------+
    | localhost | freddy | 7558e8646e17a372 | Y | Y | Y
    | Y | Y | Y | Y | Y | Y
    | Y | Y | Y | Y | Y |
    +-----------+-------+------------------+-------------+-------------+------------
    -+-------------+-------------+-----------+-------------+---------------+--------
    ------+-----------+------------+-----------------+------------+------------+


    And the db table

    +------+-------+------+-------------+-------------+-------------+-------------+-
    ------------+-----------+------------+-----------------+------------+-----------
    -+
    | Host | Db | User | Select_priv | Insert_priv | Update_priv | Delete_priv |
    Create_priv | Drop_priv | Grant_priv | References_priv | Index_priv | Alter_priv
    |
    +------+-------+------+-------------+-------------+-------------+-------------+-
    ------------+-----------+------------+-----------------+------------+-----------
    -+
    | % | test | freddy | Y | Y | Y | Y |
    Y | Y | N | Y | Y | Y
    |
    +------+-------+------+-------------+-------------+-------------+-------------+-
    ------------+-----------+------------+-----------------+------------+-----------
    -+
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  7. #7
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay so just checked the docs at mysql.com
    http://www.mysql.com/documentation/m...l#Adding_users

    Looks like its probably easier to use GRANT

    Samples

    give access to some user for everything same as root

    GRANT ALL PRIVILEGES ON *.* to username@localhost IDENTIFIED BY 'somepassword' WITH GRANT OPTION

    give access for select, update, delete and such

    GRANT ALL PRIVILEGES ON *.* to username@localhost IDENTIFIED BY 'somepassword'

    give access for select, update, delete and such to one database

    GRANT ALL PRIVILEGES ON dbname.* to username@localhost IDENTIFIED BY 'somepassword'

    Make dsure to run FLUSH PRIVILEGES after you are done.

    <Edited by freddydoesphp on 01-18-2001 at 12:39 AM>
    Please don't PM me with questions.
    Use the forums, that is what they are here for.


Bookmarks

Posting Permissions

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