I want to be able to play around with mysql and php webpages. So I want to create/use a database as a new user.
mysql -u root -p mysql> create web_events;
This creates a new database called web_events. Now I want a particular user to be able to do anything to it.
mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | test | | web_events | +--------------------+ 4 rows in set (0.00 sec) mysql> grant all on web_events.* to user1@localhost identified by "secret"; mysql> select Host,User,Password from user; +-----------+-------+------------------+ | Host | User | Password | +-----------+-------+------------------+ | localhost | root | 1e3392c069a69a58 | | localhost | user1 | 66d28a553dc2d3a7 | +-----------+-------+------------------+ 2 rows in set (0.00 sec)
Now I can log in as user1 and see the databases available.
hep:~: mysql -u user1 -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 19 to server version: 5.0.18Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| test |
| web_events |
+--------------------+
3 rows in set (0.00 sec)