Mysql关于用户和权限常用命令

创建本地登陆的用户test

CREATE USER test@localhost IDENTIFIED BY 'passwd';

修改用户密码

ALTER USER test@localhost IDENTIFIED WITH mysql_native_password BY 'new_passwd';

允许本地用户test全权操作数据库laravel

GRANT ALL PRIVILEGES ON laravel.* TO test@localhost;
flush privileges;

修改当前登录用户密码

mysql>SET PASSWORD = PASSWORD('new passwd');

修改用户test的密码

mysql>SET PASSWORD FOR 'test'@'localhost' = PASSWORD('newpasswd');

删除用户test

mysql>DROP USER 'test'@'localhost';

你可能感兴趣的:(Mysql关于用户和权限常用命令)