MySQL: Create User

How to create user and give the necessary grants:

create user 'ms'@'111.222.11.22' identified by 'swkb123';

grant select, delete, insert, update on myschema.* to 'ms'@'111.222.11.22'
grant all privileges on myschema.* to 'ms'@'111.222.11.22';

The data is stored in user table:

[root@K8H6B1 nista]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1096
Server version: 5.1.40-log Mandriva Linux - MySQL Standard Edition (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> use mysql;
Database changed
mysql> select user, host, select_priv, delete_priv, update_priv, insert_priv from user;
+------+----------------+-------------+-------------+-------------+-------------+
| user | host           | select_priv | delete_priv | update_priv | insert_priv |
+------+----------------+-------------+-------------+-------------+-------------+
| root | localhost      | Y           | Y           | Y           | Y           |
|      | localhost      | N           | N           | N           | N           |
| root | k8h6b0         | Y           | Y           | Y           | Y           |
| gb   | localhost      | N           | N           | N           | N           |
| ms   | 195.134.119.20 | N           | N           | N           | N           |

Leave a Reply