1use mysql; 2create database MYSQLtest; 3set @orig_sql_mode= @@sql_mode; 4set sql_mode= (select replace(@@sql_mode,'NO_AUTO_CREATE_USER','')); 5Warnings: 6Warning 3090 Changing sql mode 'NO_AUTO_CREATE_USER' is deprecated. It will be removed in a future release. 7grant all on MySQLtest.* to mysqltest_1@localhost; 8Warnings: 9Warning 1287 Using GRANT for creating new user is deprecated and will be removed in future release. Create new user with CREATE USER statement. 10set sql_mode= @orig_sql_mode; 11Warnings: 12Warning 3090 Changing sql mode 'NO_AUTO_CREATE_USER' is deprecated. It will be removed in a future release. 13show grants for mysqltest_1@localhost; 14Grants for mysqltest_1@localhost 15GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' 16GRANT ALL PRIVILEGES ON `mysqltest`.* TO 'mysqltest_1'@'localhost' 17select * from db where user = 'mysqltest_1'; 18Host 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 19localhost mysqltest mysqltest_1 Y Y Y Y Y Y N Y Y Y Y Y Y Y Y Y Y Y Y 20update db set db = 'MYSQLtest' where db = 'mysqltest' and user = 'mysqltest_1' and host = 'localhost'; 21flush privileges; 22show grants for mysqltest_1@localhost; 23Grants for mysqltest_1@localhost 24GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' 25GRANT ALL PRIVILEGES ON `mysqltest`.* TO 'mysqltest_1'@'localhost' 26select * from db where user = 'mysqltest_1'; 27Host 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 28localhost MYSQLtest mysqltest_1 Y Y Y Y Y Y N Y Y Y Y Y Y Y Y Y Y Y Y 29delete from db where db = 'MYSQLtest' and user = 'mysqltest_1' and host = 'localhost'; 30flush privileges; 31drop user mysqltest_1@localhost; 32drop database MYSQLtest; 33