Total Pageviews

Monday, 3 August 2015

mysql远程登录的命令

如果仅限同一台主机上可登录,命令为:

grant all on dbname.* to user@localhost identified by 'user-password';

(注意这里围绕user-password的英文单引号一定要加上)

如果是远程登录,命令为:

grant all on dbname.* to user@% identified by 'user-password';

或者grant all on dbname.* to user@hostname identified by 'user-password';

(注意这里hostname为db所在的host的hostname)

------------------------------------------------------

grant all on *.* ,the first * means waht?
        Martin     23:48:22       
    all databases   
        ym     23:50:12       
    the second * means waht?
        Martin     23:50:30       
    all tables on the database