Re: Multiple Access to Database
| From: | David Robley | Date: | Sun, 15 Jan 2012 10:45:50 +0000 |
| Subject: | Re: Multiple Access to Database | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-48165@lists.php.net to get a copy of this message | ||
Ethan Rosenberg wrote:
> Dear List -
>
> I have a database:
>
> mysql> show tables;
> +---------------------+
> | Tables_in_hospital2 |
> +---------------------+
> | Intake3 |
> | Visit3 |
> +---------------------+
>
>
> mysql> describe Intake3;
> +--------+-------------+------+-----+---------+-------+
> | Field | Type | Null | Key | Default | Extra |
> +--------+-------------+------+-----+---------+-------+
> | Site | varchar(6) | NO | PRI | | |
> | MedRec | int(6) | NO | PRI | NULL | |
> | Fname | varchar(15) | YES | | NULL | |
> | Lname | varchar(30) | YES | | NULL | |
> | Phone | varchar(30) | YES | | NULL | |
> | Height | int(4) | YES | | NULL | |
> | Sex | char(7) | YES | | NULL | |
> | Hx | text | YES | | NULL | |
> +--------+-------------+------+-----+---------+-------+
>
> mysql> describe Visit3;
> +--------+--------------+------+-----+---------+----------------+
> | Field | Type | Null | Key | Default | Extra |
> +--------+--------------+------+-----+---------+----------------+
> | Indx | int(4) | NO | PRI | NULL | auto_increment |
> | Site | varchar(6) | YES | | NULL | |
> | MedRec | int(6) | YES | | NULL | |
> | Notes | text | YES | | NULL | |
> | Weight | int(4) | YES | | NULL | |
> | BMI | decimal(3,1) | YES | | NULL | |
> | Date | date | YES | | NULL | |
> +--------+--------------+------+-----+---------+----------------+
>
> I want Bob to have access to all tables and fields, with all privileges.
> I want John to have read access to Visit3: fields [Site, MedRec,
> Weight, BMI]
>
> 1] How do I do it?
> 2] In the case that I have two users with write access to a table, how
> do I lock the tables/fields so that the two users can not change the
> same varible at the same time?
>
> Thanks.
>
> Ethan
Start with http://dev.mysql.com/doc/refman/5.5/en/privilege-system.html
Cheers
--
David Robley
Heads I win, tails you lose.
Today is Setting Orange, the 15th day of Chaos in the YOLD 3178.