select host, user from mysql.user order by user;
lists mysql users
select table_schema, table_name, engine, table_collation from information_schema.tables where table_schema like 'testdb';
identifes tables in the testdb database
create user 'testuser'@'localhost' identified by 'mysqltestpass';
creates a user named testuser
update user set password=PASSWORD("mysqltestpassnew") where user='testuser';
changes the user's password
grant select on testdb.* to 'testuser'@'localhost';
grants the testuser select privilege to all tables on the testdb database
revoke select on testdb.* from 'testuser'@'localhost';
removes the testuser's select privilege from all tables on the testdb database
drop user 'testuser'@'localhost';
lists mysql users
select table_schema, table_name, engine, table_collation from information_schema.tables where table_schema like 'testdb';
identifes tables in the testdb database
create user 'testuser'@'localhost' identified by 'mysqltestpass';
creates a user named testuser
update user set password=PASSWORD("mysqltestpassnew") where user='testuser';
changes the user's password
grant select on testdb.* to 'testuser'@'localhost';
grants the testuser select privilege to all tables on the testdb database
revoke select on testdb.* from 'testuser'@'localhost';
removes the testuser's select privilege from all tables on the testdb database
drop user 'testuser'@'localhost';
deletes user named testuser
Comments
Post a Comment