mysql中建立包括特殊字元的帳號

tengrid發表於2009-05-18

要求建立一個帳號為!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;                     

從client方連線
$ ./mysql -u\!bbs@ -p -h192.168.1.0         


 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/94384/viewspace-600273/,如需轉載,請註明出處,否則將追究法律責任。

相關文章