您好,欢迎访问一九零五行业门户网

MySQL添加用户与授权(dbforgestudiomysql)图文详解,远程访问_MySQL

win7的32位系统,通过dbforge studio mysql工具操作mysqlmysql中添加用户,新建数据库,用户授权,删除用户,修改密码(注意每行后边都跟个;表示一个命令语句结束):
1.创建连接
1.1 登录mysql:用root登录
测试一下状态
1.2 创建用户:
grant usage on *.* to user01'@'localhost' identified by '123456' with grant option;
上面红色部分是一个不存在的用户,执行上面语句,就创建了一个用户为:username,密码:password的用户。
1.3 然后登录一下:
测试一下
2.为用户授权
用root用户登录,登录后的界面
vcq9z8kjrmraykgmizi2njg0o8q9o7pncmfudcdiqm/eig9uimr9vt2/4i4qihrvinpdu6fd+0c1x8k81ve7+ibpzgvudglmawvkigj5iczxdw90o8pcwusmcxvvdds7oae8l3a+cjxwpjxpbwcgc3jjpq== alt=\>
2.1如果想指定部分权限给一用户,可以这样来写:
grant select,update on testdb.* to user01@localhost identified by 123456';
flush privileges; //刷新系统权限表
2.2 授权本数据库可以远程登录user01用户权限:
例如,你想myuser使用mypassword从任何主机连接到mysql服务器的话。
grant all privileges on *.* to 'myuser'@'%' identified by 'mypassword' with grant option;
flush privileges;
如果你想允许用户myuser从ip为192.168.1.9的主机连接到mysql服务器,并使用mypassword作为密码
grant all privileges on *.* to 'myuser'@'192.168.1.3' identified by 'mypassword' with grant option;
flush privileges;
如果你想允许用户myuser从ip为192.168.1.9的主机连接到mysql服务器的dk数据库,并使用mypassword作为密码
grant all privileges on dk.* to 'myuser'@'192.168.1.3' identified by 'mypassword' with grant option;
flush privileges;
2.3 授权user01用户拥有所有数据库的某些权限:  
mysql>grant select,delete,update,create,drop on *.* to user01@% identified by 123456;
//user01用户对所有数据库都有select,delete,update,create,drop 权限。
  //@% 表示对所有非本地主机授权,不包括localhost。(localhost地址设为127.0.0.1,如果设为真实的本地地址,不知道是否可以,没有验证。)
  //对localhost授权:加上一句grant all privileges on testdb.* to test@localhost identified by '1234';即可。
其它类似信息

推荐信息