$ ls ~yifei/notes/

mysql 基础知识 (4) - 用户和权限

Posted on:

Last modified:

创建用户

CREATE USER "newuser"@"%" IDENTIFIED BY "password";

授权所有权限

GRANT ALL PRIVILEGES ON *.* TO "newuser"@"%";
FLUSH PRIVILEGES;

其中的 % 代表这个用户可以在任意主机登录。

如果只需要在本机登录,使用 localhost

显示一个用户的当前授权:

SHOW GRANTS FOR newuser

更改用户密码:

ALTER USER 'root'@'localhost' IDENTIFIED BY 'yourpasswd';
flush privileges;

其他问题

EXPLAIN, slow-log

WeChat Qr Code

© 2016-2022 Yifei Kong. Powered by ynotes

All contents are under the CC-BY-NC-SA license, if not otherwise specified.

Opinions expressed here are solely my own and do not express the views or opinions of my employer.

友情链接: MySQL 教程站