如何使用MySQL grant命令结合Host通配符设置远程授权访问权限?
- 内容介绍
- 文章标签
- 相关推荐
本文共计1019个文字,预计阅读时间需要5分钟。
MySQL 的 `GRANT` 语句需要明确声明用户可从哪些主机连接,以及哪些数据库和表有权限操作。默认情况下,`host` 字段不可选,其默认值为 `localhost`。
如果你只写 `GRANT ... TO 'user'`,会报错,如 `ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement` 或 `ERROR 1133 (42000): Can't find any matching row in the user table` —— 这是因为没有指定具体的用户实体。
本文共计1019个文字,预计阅读时间需要5分钟。
MySQL 的 `GRANT` 语句需要明确声明用户可从哪些主机连接,以及哪些数据库和表有权限操作。默认情况下,`host` 字段不可选,其默认值为 `localhost`。
如果你只写 `GRANT ... TO 'user'`,会报错,如 `ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement` 或 `ERROR 1133 (42000): Can't find any matching row in the user table` —— 这是因为没有指定具体的用户实体。

