系统是64位Windows 7,MySQL版本为5.1。数据库服务器装在局域网中的另一台机器上,ip是:192.168.0.101。想通过另一台机器(ip为192.168.0.100)远程连接101,于是在101上执行这句:grant all privieleges on dbsrv.* to 'root' @ '%'; 结果返回这个错误: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 'privilegies on dbsrv.* to 'root' @ '%'' at line 1.请问这个命令语句需要什么样的格式?用户root两边的单引号究竟是使用esc键下边的那个符号键还是使用键盘中纯粹的单引号键?%后边需要加identified by 这样的附加信息吗?请有过这方面经验的高手给予解答。谢谢。
grant all privileges on *.* to aa@'192.167.0.6' identified by "123";
GRANT ALL PRIVILEGES ON dbsrv.* TO root@'%'
当权限1,权限2,…权限n被all privileges或者all代替,表示赋予用户全部权限。
当数据库名称.表名称被*.*代替,表示赋予用户操作服务器上所有数据库所有表的权限。
用户地址可以是localhost,也可以是ip地址、机器名字、域名。也可以用’%'表示从任何地址连接。
‘连接口令’不能为空,否则创建失败。2. 键盘中纯粹的单引号键3.需要
PRIVILEGES root or `root`GRANT ALL PRIVILEGES ON dbsrv.* TO root@'%'
mysql> grant all privileges on dbsrv.* to 'root' @ '%';
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 ''%''
at line 1附加信息:root 在我本机上已经可以使用localhost地址,命令中root是否要用单引号括起来?
grant all privileges on dbsrv.* to root@'%';
看过了,这次我把数据库名部分改成了“*.*”, 结果是这样的:mysql> grant all privileges on *.* to root @ '%' identified by '123';
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 ''%' i
dentified by '123'' at line 1