mysql -u root -p
##--------Create LAN User------##
CREATE USER 'root'@'localhost' IDENTIFIED BY 'Sipl@3333';
##--------Create Remote User------##
CREATE USER 'root'@'%' IDENTIFIED BY 'Sipl@3333';
##-----Give LAN user Admin access--------##
GRANT ALL ON *.* TO 'admin'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;
##-----Give remote user Admin access--------##
GRANT ALL ON *.* TO 'root'@'%' IDENTIFIED BY 'Sipl@3333' WITH GRANT OPTION;
##-----Give remote Admin user to access from specific ip--------##
GRANT ALL ON *.* TO 'admin'@'192.168.1.%' IDENTIFIED BY 'password' WITH GRANT OPTION;
##---------Create limited user for LAN & grant manually permission----------##
CREATE USER 'mycrop'@'localhost' IDENTIFIED BY 'XGRmZeMcu4Jm@6606';
GRANT SELECT, INSERT, UPDATE, DELETE, ALTER, CREATE, DROP, INDEX, LOCK TABLES ON mycrop_db.* TO 'mycrop'@'%';
##---------Create limited user for remote----------##
CREATE USER 'mycrop'@'%' IDENTIFIED BY 'XGRmZeMcu4Jm@6606';
GRANT SELECT, INSERT, UPDATE, DELETE, ALTER, CREATE, DROP, INDEX, LOCK TABLES ON mycrop_db.* TO 'mycrop'@'%';
##---------To setup root password for first time, use mysqladmin command at shell prompt as follows:-------##
$ mysqladmin -u root password NEWPASSWO
##--------If you want to change or update a root user password, then you need to use the following command:--------##
$ mysqladmin -u root -p'oldpassword' password newpass
##------Create a new mysql database called demo. --------------##
mysql> CREATE DATABASE demo;
##----------Assign database to lan user with limited permissions----------##
GRANT ALL ON database_demo.* TO 'root'@'localhost' IDENTIFIED BY 'mypassword';
##----------Assign database to lan user with Full permissions----------##
GRANT ALL ON database_demo.* TO 'root'@'localhost' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;
##----------Assign database to remote user with limited permissions----------##
GRANT ALL ON database_demo.* TO 'root'@'%' IDENTIFIED BY 'mypassword';
##----------Assign database to remote user with Full permissions----------##
GRANT ALL ON database_demo.* TO 'root'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;
##----------Delete lan user------------------###
DROP USER 'jeffrey'@'localhost';
##----------Delete remote user------------------###
DROP USER 'jeffrey'@'%';
##--------Create LAN User------##
CREATE USER 'root'@'localhost' IDENTIFIED BY 'Sipl@3333';
##--------Create Remote User------##
CREATE USER 'root'@'%' IDENTIFIED BY 'Sipl@3333';
##-----Give LAN user Admin access--------##
GRANT ALL ON *.* TO 'admin'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;
##-----Give remote user Admin access--------##
GRANT ALL ON *.* TO 'root'@'%' IDENTIFIED BY 'Sipl@3333' WITH GRANT OPTION;
##-----Give remote Admin user to access from specific ip--------##
GRANT ALL ON *.* TO 'admin'@'192.168.1.%' IDENTIFIED BY 'password' WITH GRANT OPTION;
##---------Create limited user for LAN & grant manually permission----------##
CREATE USER 'mycrop'@'localhost' IDENTIFIED BY 'XGRmZeMcu4Jm@6606';
GRANT SELECT, INSERT, UPDATE, DELETE, ALTER, CREATE, DROP, INDEX, LOCK TABLES ON mycrop_db.* TO 'mycrop'@'%';
##---------Create limited user for remote----------##
CREATE USER 'mycrop'@'%' IDENTIFIED BY 'XGRmZeMcu4Jm@6606';
GRANT SELECT, INSERT, UPDATE, DELETE, ALTER, CREATE, DROP, INDEX, LOCK TABLES ON mycrop_db.* TO 'mycrop'@'%';
##---------To setup root password for first time, use mysqladmin command at shell prompt as follows:-------##
$ mysqladmin -u root password NEWPASSWO
##--------If you want to change or update a root user password, then you need to use the following command:--------##
$ mysqladmin -u root -p'oldpassword' password newpass
##------Create a new mysql database called demo. --------------##
mysql> CREATE DATABASE demo;
##----------Assign database to lan user with limited permissions----------##
GRANT ALL ON database_demo.* TO 'root'@'localhost' IDENTIFIED BY 'mypassword';
##----------Assign database to lan user with Full permissions----------##
GRANT ALL ON database_demo.* TO 'root'@'localhost' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;
##----------Assign database to remote user with limited permissions----------##
GRANT ALL ON database_demo.* TO 'root'@'%' IDENTIFIED BY 'mypassword';
##----------Assign database to remote user with Full permissions----------##
GRANT ALL ON database_demo.* TO 'root'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;
##----------Delete lan user------------------###
DROP USER 'jeffrey'@'localhost';
##----------Delete remote user------------------###
DROP USER 'jeffrey'@'%';
0 comments:
Post a Comment