User management is quite easy to handle with phpMyAdmin or with MySQLWorkbench, but
it is useful to know also how to do it with command-line. Check the instructions from
mysql-section
But it might be good idea to use MySQLWorkbench to check what happens, when you make
the steps in this exercise. So in Workbench open Server->Users and Privileges
In MySQLServer all the user informations are in database named mysql.
That database has an table named user and that table has an field named User.
So you can allways check which users do you have with commad
SELECT User FROM mysql.user;
And if you want to check also the hosts where they are able to connect, you can use command
SELECT User,Host FROM mysql.user;
You can handle the user's privileges with GRANT-commands.
Check the syntax of GRANT from http://dev.mysql.com/doc/refman/5.1/en/grant.html and then make the exercises
- Start UniServerController and MySQL-server and open MySQL-console
- Check that you have databases project and library. If you havent project, so create it (you can find the codes from mainpage).
And if you don't have database library you have to make the exercise2 first.
- Create user named "testUser" which has password is testPass
- Add to testUser SELECT-privileges to all tables in database project, if connect from localhost
- Open ServerConsole and login with testUser
- As a testUser check which databases you can see
- As a testUser execute some SELECT queries
- As a testUser try to INSERT new person to person-table
- As a root add INSERT-privilege to testUser to project-database tables, from localhost
- As a testUser try to INSERT new person to person-table (perhaps you have to logout and login again)
- As a testUser try to DELETE the "new person" from person-table
- As a root add DELETE-privilege to testUser to project-database's person-table, from localhost
- As a testUser try again to DELETE the "new person" from person-table
- As a root remove SELECT privilege from testUser to database project
- As a testUser check which databases you can see
- As a testUser logout
- Check from http://dev.mysql.com/doc/refman/5.0/en/drop-user.html how DROP USER command works
- As a root remove the testUser and check that the user doesn't exist
- Try to login as a testUser