You need to look over the table mysql.user
Usually you can run this query to see the usernames, host addresses, and MD5-encrypted passwords.
SELECT user,host,password FROM mysql.user;
EXAMPLE #1 : let's create a user called 'myclient' who will connect to mysql from an Ubuntu server whose IP address is '123.50.89.191' and who can fully access and manipulate everything in the database 'mydata'. The password will be 'permission';
GRANT ALL PRIVILEGES on mydata.*
TO 'myclient'@'123.50.89.191'
IDENTIFIED BY 'permission';
EXAMPLE #2 : let's create a user called 'myreadclient' who will connect to mysql from an Ubuntu server whose IP address is '123.50.89.191' and who can only INSERT and SELECT everything in the database 'mydata'. The password will be 'readpermission';
GRANT INSERT,SELECT on mydata.*
TO 'myreadclient'@'123.50.89.191'
IDENTIFIED BY 'readpermission';
For more on how to create users with specific privileges, please follow this URL.
Give it a Try !!!
CAVEAT
It is always better to set up password in MD5 format rather than plain text passwords.
Example
mysql> SET @X=PASSWORD('permission');
Query OK, 0 rows affected (0.00 sec)
mysql> SELECT @X;
+-------------------------------------------+
| @X |
+-------------------------------------------+
| *1D6447E2F5B7AFD0E27D8E6CCA53099BE980803C |
+-------------------------------------------+
1 row in set (0.00 sec)
Now, set the password for the first example like this:
GRANT ALL PRIVILEGES on mydata.*
TO 'myclient'@'123.50.89.191'
IDENTIFIED BY PASSWORD @X;
Here is the second example using MD5 format
mysql> SET @X=PASSWORD('readpermission');
Query OK, 0 rows affected (0.01 sec)
mysql> SELECT @X;
+-------------------------------------------+
| @X |
+-------------------------------------------+
| *22DA1CEDDBA3B75FD193775AC69D9184105F0BE0 |
+-------------------------------------------+
1 row in set (0.00 sec)
GRANT INSERT,SELECT on mydata.*
TO 'myreadclient'@'123.50.89.191'
IDENTIFIED BY PASSWORD @X;
Doing this will protect against recording the plain text password in binary logs or any file that is recording mysql client sessions.