- 1. How to create user?
- CREATE USER username@host IDENTIFIED BY password
- Ex: CREATE USER 'akila'@'localhost' IDENTIFIED BY 'akila';
- 2. How to set password for the user?
- # SET PASSWORD FOR username=PASSWORD(password);
- Example: # SET PASSWORD FOR 'akila' = PASSWORD ('akila');
- # UPDATE mysql.user SET Password=PASSWORD ('AKILA') WHERE user='akila' AND host='localhost';
- 3. How to grant permission?
- GRANT ALL PRIVILEGES ON database TO 'akila'@'localhost' IDENTIFIED BY 'akila';
- 4. How to switch to another user?
- # mysql -u user –p
- Enter Password:
- 5. How to show users in the database?
- SELECT * FROM mysql.user
Tuesday, July 26, 2011
MySql - User related commands
Labels:
MySql