visit MySQL quary part 1
visit MySQL quary part 2
visit MySQL quary part 3
visit MySQL quary part 4
Create user
CREATE USER 'user'@'localhost' IDENTIFIED BY 'password';
- user-user name of the user that we creating
- password-password of the user that we creating
Grant privilege to user (you can set grant that you wont using one of this query)
GRANT ALL PRIVILEGES ON *.* TO 'user'@'localhost'; GRANT ALL PRIVILEGES ON database.* TO 'user'@'localhost'; GRANT ALL PRIVILEGES ON database.table TO 'user'@'localhost'; GRANT SELECT, INSERT, DELETE ON database.* TO 'user'@'localhost';
- database-database name which we grant access
- table-table name which we grant access
- ALL PRIVILEGES – grants all privileges to the MySQL user
- CREATE – allows the user to create databases and tables
- DROP - allows the user to drop databases and tables
- DELETE - allows the user to delete rows from specific MySQL table
- INSERT - allows the user to insert rows into specific MySQL table
- SELECT – allows the user to read the database
- UPDATE - allows the user to update table rows
View privileges
SHOW GRANTS FOR 'user'@'localhost';
Save privileges
FLUSH PRIVILEGES;
Remove user
DROP USER 'user'@'localhost'
Now you have create user named as user with password equal to password.then youcan login to mysql using
mysql -u user -p
No comments:
Post a Comment