mysql database to add users and assign permissions specific implementation

  • 2020-06-07 05:26:51
  • OfStack

Create users and assign permissions;
 
insert into mysql.user(Host,User,Password) values("localhost","phplamp",password("1234"));// Create a user  
grant all privileges on dbname.* to 'username'@'%' identified by 'password';// Create the user and assign all permissions  
grant select,update on phplampDB.* to phplamp@localhost identified by '1234';// Create users and assign permissions  
update mysql.user set password=password(' The new password ') where User="phplamp" and Host="localhost";// Change user password  
-- Deletes user-specified permissions  
revoke insert,update,delete,select ON *.* from 'xbb'@'localhost' IDENTIFIED BY '123'; 

Related articles: