如何在MySQL中授予数据库复制权限?
要授予复制特权,请使用GRANT REPLICATION SLAVE ON。
首先列出所有用户名以及MySQL.user表中的主机-
mysql> select user,host from mysql.user;
这将产生以下输出-
+------------------+-----------+| user | host |
+------------------+-----------+
| Bob | % |
| Charlie | % |
| Robert | % |
| User2 | % |
| mysql.infoschema | % |
| mysql.session | % |
| mysql.sys | % |
| root | % |
| @UserName@ | localhost |
| Adam | localhost |
| Adam Smith | localhost |
| Chris | localhost |
| David | localhost |
| James | localhost |
| John | localhost |
| John Doe | localhost |
| Mike | localhost |
| User1 | localhost |
| am | localhost |
| hbstudent | localhost |
| mysql.infoschema | localhost |
| mysql.session | localhost |
+------------------+-----------+
22 rows in set (0.00 sec)
让我们实现上述语法,向MySQL中的数据库授予复制权限-
mysql> GRANT REPLICATION SLAVE ON *.* TO 'Mike'@'localhost';
让我们检查拨款是否成功-
mysql> SHOW GRANTS FOR 'Mike'@'localhost';
这将产生以下输出-
+------------------------------------------------------+| Grants for Mike@localhost |
+------------------------------------------------------+
| GRANT REPLICATION SLAVE ON *.* TO `Mike`@`localhost` |
+------------------------------------------------------+
1 row in set (0.04 sec)
以上是 如何在MySQL中授予数据库复制权限? 的全部内容, 来源链接: utcz.com/z/316206.html