Database Reference
In-Depth Information
+--------------------+
| Database |
+--------------------+
| information_schema |
| rookery |
| test |
+--------------------+
+---------------------+
| Avocets |
+---------------------+
| Pied Avocet |
| Red-necked Avocet |
| Andean Avocet |
| American Avocet |
| Mountain Avocetbill |
+---------------------+
Restricting to specific tables
At this point, Lena hassufficient access to the two databases when at her office. However,
although she can select data on the
rookery
database from home, she can't access the
birdwatchers
databases from home. Let's give her the
SELECT
privilege for that
database, but only for certain tables.
If we want to give Lena access only to the
bird_sightings
table in the
bird-
watchers
database from home, we would enter the following:
GRANT SELECT ON birdwatchers.bird_sightings
TO 'lena_stankoska'@'lena_stankoska_home';
SHOW GRANTS FOR 'lena_stankoska'@'lena_stankoska_home';
+---------------------------------------------------------------------------+
| Grants for
lena_stankoska@lena_stankoska_home |
+---------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO
'lena_stankoska'@'lena_stankoska_home' |
| IDENTIFIED BY PASSWORD
'...' |
| GRANT SELECT ON `rookery`.* TO
'lena_stankoska'@'lena_stankoska_home' |
| GRANT SELECT ON
`birdwatchers`.`bird_sightings` |
| TO
'lena_stankoska'@'lena_stankoska_home'