要求创建一个帐号为!bbs@,口令为%adfdf$df%
mysql> grant select on *.* to \!bbs@@localhost identified by 'a';
sh: identified: command not found
->
mysql> grant select on *.* to !bbs@@192.168.1.2 identified by '%dfsd$bbs%';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '!bbs@@192.168.1.2 identified by '%admdfdsf$bbs%'' at line 1
mysql>
解决这个问题的方法是直接向mysql.user表中insert一条记录
mysql>insert into user(host,user,password,Select_priv)
values('192.168.1.2','!bbs@',password('%admidfsdfbbs%'),'Y');
mysql>flush privileges; <---注意一定要flush
从client方连接
$ ./mysql -u\!bbs@ -p -h192.168.1.0 <---注意将!转义
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/94384/viewspace-600273/ ,如需转载,请注明出处,否则将追究法律责任。