首页 > 代码库 > Mysql常用操作

Mysql常用操作

mysql的常用操作

创建数据库用户:CREATE USER ‘username‘@‘localhost‘ IDENTIFIED BY ‘PASSWORD‘;

删除数据库用户:DELETE FROM user WHERE User="username" and Host="localhost";

给用户授权:    GRANT ALL PRIVILEGES ON *.* TO ‘uname‘@‘localhost‘ WITH GRANT OPTION;

更新用户密码:  use mysql; update user set password=password(‘PASSWORD‘) where user=‘username‘;

查看数据库用户:use mysql; select user,host from user;

查看数据库用户相应的权限:show grants for username@‘localhost‘;


Mysql常用操作