2
create database MYSQLtest;
3
grant all on MySQLtest.* to mysqltest_1@localhost;
4
show grants for mysqltest_1@localhost;
5
Grants for mysqltest_1@localhost
6
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
7
GRANT ALL PRIVILEGES ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
8
select * from db where user = 'mysqltest_1';
9
Host Db User Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Grant_priv References_priv Index_priv Alter_priv Create_tmp_table_priv Lock_tables_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Execute_priv Event_priv Trigger_priv
10
localhost mysqltest mysqltest_1 Y Y Y Y Y Y N Y Y Y Y Y Y Y Y Y Y Y Y
11
update db set db = 'MYSQLtest' where db = 'mysqltest' and user = 'mysqltest_1' and host = 'localhost';
13
show grants for mysqltest_1@localhost;
14
Grants for mysqltest_1@localhost
15
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
16
GRANT ALL PRIVILEGES ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
17
select * from db where user = 'mysqltest_1';
18
Host Db User Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Grant_priv References_priv Index_priv Alter_priv Create_tmp_table_priv Lock_tables_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Execute_priv Event_priv Trigger_priv
19
localhost MYSQLtest mysqltest_1 Y Y Y Y Y Y N Y Y Y Y Y Y Y Y Y Y Y Y
20
delete from db where db = 'MYSQLtest' and user = 'mysqltest_1' and host = 'localhost';
22
drop user mysqltest_1@localhost;
23
drop database MYSQLtest;