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

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

WBOY
WBOYOriginal
2016-06-01 13:04:161678browse

win7的32位系统,通过dbforge studio mysql工具操作mysql MySql中添加用户,新建数据库,用户授权,删除用户,修改密码(注意每行后边都跟个;表示一个命令语句结束):

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';即可。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn