1use mysql;
2set sql_mode="";
3create database MYSQLtest;
4grant all on MySQLtest.* to mysqltest_1@localhost;
5show grants for mysqltest_1@localhost;
6Grants for mysqltest_1@localhost
7GRANT USAGE ON *.* TO `mysqltest_1`@`localhost`
8GRANT ALL PRIVILEGES ON `mysqltest`.* TO `mysqltest_1`@`localhost`
9select * from db where user = 'mysqltest_1';
10Host	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	Delete_history_priv
11localhost	mysqltest	mysqltest_1	Y	Y	Y	Y	Y	Y	N	Y	Y	Y	Y	Y	Y	Y	Y	Y	Y	Y	Y	Y
12update db set db = 'MYSQLtest' where db = 'mysqltest' and user = 'mysqltest_1' and host = 'localhost';
13flush privileges;
14show grants for mysqltest_1@localhost;
15Grants for mysqltest_1@localhost
16GRANT USAGE ON *.* TO `mysqltest_1`@`localhost`
17GRANT ALL PRIVILEGES ON `mysqltest`.* TO `mysqltest_1`@`localhost`
18select * from db where user = 'mysqltest_1';
19Host	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	Delete_history_priv
20localhost	MYSQLtest	mysqltest_1	Y	Y	Y	Y	Y	Y	N	Y	Y	Y	Y	Y	Y	Y	Y	Y	Y	Y	Y	Y
21delete from db where db = 'MYSQLtest' and user = 'mysqltest_1' and host = 'localhost';
22flush privileges;
23drop user mysqltest_1@localhost;
24drop database MYSQLtest;
25