News:

MyKidsDiary.in :: Capture your kids magical moment and create your Online Private Diary for your kids

Main Menu

MySQL Tutorial » Privilege » User

Started by VelMurugan, Apr 21, 2009, 12:16 PM

Previous topic - Next topic

VelMurugan

Add a user

Quotemysql>
INSERT INTO user VALUES('localhost','TestUser',PASSWORD('pass123'),'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y')
mysql>
mysql>

Add your database and users to the mysql database

Quotemysql>
INSERT INTO db VALUES('localhost','sample_db','TestUser','Y','Y','Y','Y','Y','Y','Y','Y','Y', 'Y')
mysql>

In the default setting of MySQL access privileges, every user is permitted to create databases on a local computer that begin with the word 'test.'

To set up the new database test_java2s, in mysql execute the command CREATE DATABASE.

Quotemysql> CREATE DATABASE test_java2s;

Source : java2s

VelMurugan

SELECT host, user, select_priv, update_priv FROM user

Quotemysql> use mysql
Database changed
mysql> SELECT host, user, select_priv, update_priv FROM user;
+------------+------+-------------+-------------+
| host       | user | select_priv | update_priv |
+------------+------+-------------+-------------+
| localhost  | root | Y           | Y           |
| production | root | Y           | Y           |
| 127.0.0.1  | root | Y           | Y           |
+------------+------+-------------+-------------+
3 rows in set (0.03 sec)

mysql>

select convert(SUBSTR(USER(),1,INSTR(USER(),'@')-1) using latin1)


Quotemysql>
mysql> select convert(SUBSTR(USER(),1,INSTR(USER(),'@')-1) using latin1) ;
+------------------------------------------------------------+
| convert(SUBSTR(USER(),1,INSTR(USER(),'@')-1) using latin1) |
+------------------------------------------------------------+
| root                                                       |
+------------------------------------------------------------+
1 row in set (0.09 sec)

mysql>