MySQL错误:ERROR 1221 (HY000): Incorrect usage of DB GRANT and GLOBAL PRIVILEGES

MySQL错误:ERROR 1221 (HY000): Incorrect usage of DB GRANT and GLOBAL PRIVILEGES
在执行MySQL复制的前奏时:为主服务器创建用户以便从服务器连接,出现该错误:
GRANT REPLICATION SLAVE ON a_database.* to ‘repl‘@‘domain.test‘ IDENTIFIED BY ‘slavepass‘;
之所以指定数据库我是希望能只复制这个数据库而忽略其他(已创建的或今后会创建的)数据库。
因为我还不知道MySQL可以在配置文件(/etc/my.cnf)中(或启动时指定该参数)有一个专门的参数来指定数据库:--replicate-do-db=数据库名
引用:告诉从服务器限制默认数据库(由USE所选择)为db_name的语句的复制。要指定多个数据库,应多次使用该选项,每个数据库使用一次。
来自MySQL5.1 manual 6.8节,更加详细的说明参见这里:
http://dev.mysql.com/doc/refman/5.1/zh/replication.html#replication-options

参考:http://forums.mysql.com/read.php?26,47781,47828#msg-47828

官方论坛上这个问题的主题:http://forums.mysql.com/read.php?26,47781,47781
还有:http://forums.admon.org/databases/6970-error-1221-hy000-incorrect-usage-db-grant-global-privileges.html

原因:是该权限(REPLICATION SLAVE)是一个全局权限(Global privilege),不能单独指定给数据库级别(database level)。
比如,FILE权限不能授予给database level:
引用:It complains about that you are trying to use FILE privilege on a database level. And that is a Global privilege.
见:http://forums.devshed.com/mysql-help-4/error-1221-wrong-usage-of-db-grant-and-global-privileges-110852.html

SUPER权限同样适用:
见:http://webcache.googleusercontent.com/search?q=cache:http://systemadmin.es/2011/10/incorrect-usage-of-db-grant-and-global-privileges

EOF.最后的一个链接:
http://www.osgeo.org/files/fdo/docs/FET_TheEssentialFDO/files/WS1a9193826455f5ff9110c71085341391d-2981.htm

时间: 2024-12-28 17:17:41

MySQL错误:ERROR 1221 (HY000): Incorrect usage of DB GRANT and GLOBAL PRIVILEGES的相关文章

MySQL案例02:ERROR 1221 (HY000): Incorrect usage of DB GRANT and GLOBAL PRIVILEGES

MySQL在授权用户时出现报错信息,具体信息如下: 一.错误信息 执行命令: GRANT SELECT,INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION

mysql主从复制报错 :Incorrect usage of DB GRANT and GLOBAL PRIVILEGES

在配置mysql主从复制时,想通过 grant replication slave on bbs.* to 'bbs'@'192.168.1.3' identified by '123456'; 来限制主从复制只作用于bbs数据库,但是上面的语句会报错:Incorrect usage of DB GRANT and GLOBAL PRIVILEGES 因为replication slave 的级别是global,所以不能只作用于某一数据库,而是全局,如下图说明: 所以还是要通过 grant re

启动mysql错误ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)

ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2) 1.先查看 /etc/rc.d/init.d/mysqld status 看看m y s q l 是否已经启动.另外看看是不是权限问题. 2.确定你的mysql.sock是不是在那个位置,mysql -u 你的mysql用户名 -p -S /var/lib/mysql/mysql.sock 3

Mysql添加用户错误:ERROR 1364 (HY000): Field 'ssl_cipher' doesn't have a default value解决方法

添加用户 insert into mysql.user(Host,User,Password) values("localhost","test",password("1234")); 报以下的错误 ERROR 1364 (HY000): Field 'ssl_cipher' doesn't have a default value错误 mysql5.1以上版本,我是在5.6版本上操作的. 错语原因: mysql用户表的中某些字段不能为空,没有默

mysql 插入中文时出现ERROR 1366 (HY000): Incorrect string value: '\xC0\xEE\xCB\xC4' for column 'usern ame' at row 1

1 环境: MySQL Server 6.0  命令行工具 2 问题 :  插入中文字符数据出现如下错误: ERROR 1366 (HY000): Incorrect string value: '\xC0\xEE\xCB\xC4' for column 'usern ame' at row 1 3 当时环境: mysql> insert into user(id , username , birthday, sex, address) values('2' , ' 李四' , '1980 12

mysql ERROR 126 (HY000): Incorrect key file for table '/tmp/#sql_1d87_0.MYI'; try to repair it

[[email protected] ~]# df -h 查看是否空间不足 在查看mysql数据目录情况 mysql> show variables like '%dir%'; +-----------------------------------------+------------------------------------+ | Variable_name                           | Value                              |

解决mysql插入中文字符报错的问题ERROR 1366 (HY000): Incorrect string value: ‘\xE5\xB0\x8F\xE6\x98\x8E‘ for column ‘name‘ at row 1

原文:解决mysql插入中文字符报错的问题ERROR 1366 (HY000): Incorrect string value: '\xE5\xB0\x8F\xE6\x98\x8E' for column 'name' at row 1 报错内容: mysql> insert into person values (1,22,'小明');ERROR 1366 (HY000): Incorrect string value: '\xE5\xB0\x8F\xE6\x98\x8E' for colum

远程mysql出现ERROR 1130 (HY000): Host '172.17.42.1' is not allowed to connect to this MySQL server

ERROR 1130: Host ***.***.***.*** is not allowed to connect to this MySQL server 说明所连接的用户帐号没有远程连接的权限,只能在本机(localhost)登录. 需更改 mysql 数据库里的 user表里的 host项 把localhost改称% 具体步骤:登陆到MySQL 首先 use mysql: 按照别人提供的方式update的时候,出现错误. MySQL> update user set host='%' w

ERROR 1366 (HY000): Incorrect string value: '\xD5\xC5\xC8\xFD' for column 'name' at row 1

ERROR 1366 (HY000): Incorrect string value: '\xD5\xC5\xC8\xFD' for column 'name' at row 1 数据库字符集问题,查看数据库状态: mysql> status; -------------- mysql  Ver 14.14 Distrib 5.6.12, for Win32 (x86) Connection id:          25 Current database:       information_