美文网首页
MySql数据库

MySql数据库

作者: 哥本哈登_sketch | 来源:发表于2017-06-15 14:53 被阅读0次

1.添加用户

解释:create user ‘用户名’@’允许登录的地址/服务器’ identified by ‘密码’;

例子:
<pre>
create user 'user1'@'localhost' identified by '123';
</pre>
//限定访问Ip:只能允许user2用户从192.168.40.78这个ip地址的用户登录,其他的不行
<pre>
create user 'user2'@'192.168.40.78' identified by '123';
</pre>

2.删除用户

解释:drop user ‘用户名’@’允许登录的地址或服务器名’;

例子:
<pre>
drop user ‘user2’@’localhost’;
</pre>

3.修改密码

修改自己的密码:

set password = password('密码');

例子:
<pre>
set password = password(‘123’);
</pre>

修改他人的密码(前提是有权限):
set password for '用户名'@'允许登录的地址' = password('密码');
例子:
<pre>
Set password for ‘user2’@’localhost’= password(‘123’);
</pre>

相关文章

网友评论

      本文标题:MySql数据库

      本文链接:https://www.haomeiwen.com/subject/ietuqxtx.html