企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
## 一、创建用户 先登录; ``` #远程用户 mysql>create user 'test'@'%' identified by 'Da#F!999$'; #本地用户 mysql>create user 'test'@'localhost' identified by 'Da#F!999$'; ``` >[danger] 远程用户登陆的时候,除了防火墙3306(默认)端口打开之外,有些云服务器还需要设置安全组的端口开放; ![](https://img.kancloud.cn/74/52/7452dcb899a2735d9bff0cae1dcedd57_1918x620.png) ## 二、用户授权 ``` #正常用户 mysql>grant all privileges on test.* to 'test'@'%' with grant option; #只读用户 mysql>grant select on test.* to 'reader'@'%' with grant option; mysql>grant process on *.* to 'reader'@'%'; mysql>flush privileges; ``` 取消授权 ``` mysql>revoke all privileges on test.* from 'test'@'%'; ``` >[danger] all privileges 可以改为select,update,insert,delete,drop,create等操作权限; ## 三、修改密码 ``` alter user 'test'@'localhost' identified by '新密码'; ```