INSERT INTO mysql.user set Host='%',user='alipay',password=password('alipay'),Select_priv='Y',Insert_priv='N',Update_priv='N',Delete_priv='N',Create_priv='N',Drop_priv='N',Reload_priv='N',Shut
down_priv='N',Process_priv='N',File_priv='N',Grant_priv='N',References_priv='N',Index_priv='N',Alter_priv='N',Show_db_priv='N',Super_priv='N',Create_tmp_table_priv='N',Lock_tables_priv='N',Exe
cute_priv='N',Repl_slave_priv='N',Repl_client_priv='N',Create_view_priv='N',Show_view_priv='N',Create_routine_priv='N',Alter_routine_priv='N',Create_user_priv='N',Event_priv='N',Trigger_priv='
N',ssl_type='',ssl_cipher='',x509_issuer='',x509_subject='',max_questions='0',max_updates='0',max_connections='0',max_user_connections='0';
mysql不同版本,user表中的列不尽相同,笔者倒是发现,如果在插入用户的时候,全部设置为Y,后面使用grant语句赋权限,却不一定能生效的。
最后flush 一下
flush privileges;
还有一种方法,未经验证,可以尝试一下:
INSERT INTO mysql.user set Host='%',user='alipay',password=password('alipay');
grant select on *.* to alipay@"%" identified by 'alipay';