- 1. How to create database?
- # CREATE DATABASE database_name;
- Ex: CREATE DATABASE employee;
- 2. How to give permissions to a user to access the database?
- # GRANT ALL PRIVILEGES ON database_name.* TO username@server IDENTIFIED BY 'password'
- Example: # GRANT ALL PRIVILEGES ON database TO 'akila'@'localhost' IDENTIFIED BY 'akila';
- 3. How to delete a database?
- #DROP DATABASE database_name;
- Ex: #DROP DATABASE test;
Showing posts with label MySql. Show all posts
Showing posts with label MySql. Show all posts
Wednesday, November 9, 2011
My SQL - Database related commands
Labels:
MySql
Tuesday, July 26, 2011
MySql - User related commands
- 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
Labels:
MySql
Subscribe to:
Posts (Atom)