您的位置:首页 > 数据库 > MySQL

mysql访问授权

2013-01-28 15:54 274 查看
在安装mysql的机器上运行:

d:\mysql\bin\>mysql -h localhost -u root


单台授权:

grant all privileges on *.* to 'root'@'10.24.23.55' identified by '1234' with grant option;


注意授权后必须flush privileges;否则无法立即生效。

多台授权:

//赋予任何主机访问数据的权限


mysql>
grant all privileges on *.* to 'root'@'%' identified by '1234' with grant option;


如果用以下则会报错:(上面是新建用户)

grant all privileges on *.* to 'root'@'%' with grant option;
----->ERROR 1133 (42000): Can't find any matching row in the user table


//修改生效

mysql> flush privileges;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: