该文章为引用 原文速递
适用于linux系统下默认只能用sudo mysql -uroot -p 的问题。
经过以下步骤,idea可以使用database工具进行连接。
创建用户
#创建用户root,可在172.25.254.3登陆,密码为redhat
create user [email protected] identified by "redhat";
# 重新查看发现已经添加
select * from mysql.user;
创建远程登陆用户和本地用户
#创建用户hello,可远程登陆(原因是后面的%通配符是允许所有主机建立连接),密码为hello
create user hello@'%' identified by "redhat";
# 重新查看发现已经添加
select * from mysql.user;
#创建用户hello,可在本机登陆,密码为hello
create user hello@localhost identified by 'hello';
用户授权
#给hello@localhost用户授权,如果为all,授权所有权限给hello@localhost用户授权,如果为all,授权所有权限(insert,update,delete,select,create)
#grant all on mariadb.* to hello@localhost;
grant ALL PRIVILEGES on *.* to liuqinghua@localhost;
#查看用户授权
show grants for hello@localhost;
撤销权限
#撤销权限
revoke create on *.* from hello@localhost;
#发现没有create权限了
show grants for hello@localhost;
删除用户
#删除用户
drop user hello@localhost;
1 条评论
?议论文评语?