MySQL数据库进阶—数据库用户管理
1、创建用户
create user ‘user’@‘localhost’ identified by ‘123’;
查看用户
select User,authentication_string,Host from mysql.user
改用户名
rename user user@localhost to test1@localhost;
删用户
drop user YGB11@localhost;
修改当前用户密码
set password for YGB1@localhost = password(321);
忘记root密码且无法登录情况修改root密码
1. 找到文件:my.cnf 2. 修改文件:my.cnf 3. 登录mysql修改密码命令:update mysql.user set authentication_string = password(‘1234’) where user=root’
- 退出删除:skip-grant-table
- 完成了root密码修改。
给创建的用户进行授权
授权查看指定的库内指定的表。
允许所有终端连接MySQL中test1用户。 查看设定的权限 取消设定的权限
