# Mysql

### 参考文章

{% embed url="<https://xie.infoq.cn/article/4e7de8ce0607bfbe24a5c2e16>" %}

### 使用

例子：创建只读用户

```
-- 创建用户   用户名：readonly  密码：123456 可自行更改 --
CREATE USER 'readonly'@'%' IDENTIFIED BY '123456';

-- 赋予用户只读权限  库名：mydb  用户：readonly --
GRANT SELECT ON mydb.* TO 'readonly'@'%';

-- 刷新权限  --
FLUSH PRIVILEGES;
```

例子：允许root用户远程登录

```
USE mysql;
UPDATE user SET host='%' WHERE user ='root';
FLUSH PRIVILEGES;
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://viva.gitbook.io/project/cun-chu/guan-xi-xing-shu-ju-ku.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
