mysql怎么刷新权限,mysql刷新权限命令错误怎么回事

mysql局域网访问权限怎么设置

第一:更改 “mysql” 数据库里的 “user” 表里的 “host” 项,从”localhost”改称'%'。

创新互联专业为企业提供宁江网站建设、宁江做网站、宁江网站设计、宁江网站制作等企业网站建设、网页设计与制作、宁江企业网站模板建站服务,十多年宁江做网站经验,不只是建网站,更提供有价值的思路和整体网络服务。

或者新加条记录,“host” 项为要访问的ip地址,并授权。重启mysql服务。

第二:在系统防火墙添加例外端口:3306,并允许例外。错误提示:

ERROR 1130: Host '192.168.1.3' is not allowed to connect to this MySQL server

的解决方法: 1。 改表法。可能是你的帐号不允许从远程登陆,只能在localhost。这个时候只要在localhost的那台电脑,登入mysql后,更改 "mysql" 数据库里的 "user" 表里的 "host" 项,从"localhost"改称"%"

mysql -u root -pvmwaremysqluse mysql;mysqlupdate user set host = '%' where user = 'root';mysqlselect host, user from user; 2. 授权法。例如,你想myuser使用mypassword从任何主机连接到mysql服务器的话。

GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;

如果你想允许用户myuser从ip为192.168.1.3的主机连接到mysql服务器,并使用mypassword作为密码

GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'192.168.1.3' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;

3.在window自带的防火墙里的例外添加3306端口

总结:mysql -u root -p

mysqluse mysql;

mysqlselect 'host' from user where user='root';

mysqlupdate user set host = '%' where user ='root';

mysqlflush privileges;

mysqlselect 'host' from user where user='root';

第一句是以权限用户root登录

第二句:选择mysql库

第三句:查看mysql库中的user表的host值(即可进行连接访问的主机/IP名称)

第四句:修改host值(以通配符%的内容增加主机/IP地址),当然也可以直接增加IP地址

第五句:刷新MySQL的系统权限相关表

第六句:再重新查看user表时,有修改。。

重起mysql服务即可完成。

linux用命令怎么修改mysql用户的权限

mysql更改用户权限

This entry was posted by admin Monday, 26 April, 2010

1.“grant all on *.* to root@’%’ identified by ‘yourpassword’;”——这个还可以顺带设置密码。

2.“flush privileges; ”——刷新一下,让权限生效。

mysql的一些其他的管理,可以用mysqladmin命令。可以用来设置密码什么的。

grant方面的详细信息可以看我下面的转载:

本文实例,运行于 MySQL 5.0 及以上版本。

MySQL 赋予用户权限命令的简单格式可概括为:

grant 权限 on 数据库对象 to 用户

一、grant 普通数据用户,查询、插入、更新、删除 数据库中所有表数据的权利。

grant select on testdb.* to common_user@’%’

grant insert on testdb.* to common_user@’%’

grant update on testdb.* to common_user@’%’

grant delete on testdb.* to common_user@’%’

或者,用一条 MySQL 命令来替代:

grant select, insert, update, delete on testdb.* to common_user@’%’

如何设置mysql用户的权限

1、创建新用户

通过root用户登录之后创建

grant all privileges on *.* to testuser@localhost identified by "123456" ;//创建新用户,用户名为testuser,密码为123456 ;

grant all privileges on *.* to testuser@localhost identified by "123456" ;//设置用户testuser,可以在本地访问mysql

grant all privileges on *.* to testuser@"%" identified by "123456" ; //设置用户testuser,可以在远程访问mysql

flush privileges ;//mysql 新设置用户或更改密码后需用flush privileges刷新MySQL的系统权限相关表,否则会出现拒绝访问,还有一种方法,就是重新启动mysql服务器,来使新设置生效

2、设置用户访问数据库权限

grant all privileges on test_db.* to testuser@localhost identified by "123456" ;//设置用户testuser,只能访问数据库test_db,其他数据库均不能访问 ;

grant all privileges on *.* to testuser@localhost identified by "123456" ;//设置用户testuser,可以访问mysql上的所有数据库 ;

grant all privileges on test_db.user_infor to testuser@localhost identified by "123456" ;//设置用户testuser,只能访问数据库test_db的表user_infor,数据库中的其他表均不能访问 ;

3、设置用户操作权限

grant all privileges on *.* to testuser@localhost identified by "123456" WITH GRANT OPTION ;//设置用户testuser,拥有所有的操作权限,也就是管理员 ;

grant select on *.* to testuser@localhost identified by "123456" WITH GRANT OPTION ;//设置用户testuser,只拥有【查询】操作权限 ;

grant select,insert on *.* to testuser@localhost identified by "123456" ;//设置用户testuser,只拥有【查询\插入】操作权限 ;

grant select,insert,update,delete on *.* to testuser@localhost identified by "123456" ;//设置用户testuser,只拥有【查询\插入】操作权限 ;

REVOKE select,insert ON what FROM testuser//取消用户testuser的【查询\插入】操作权限 ;

当前题目:mysql怎么刷新权限,mysql刷新权限命令错误怎么回事
标题URL:https://www.cdcxhl.com/article2/hedhoc.html

成都网站建设公司_创新互联,为您提供微信小程序动态网站商城网站云服务器微信公众号网站改版

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联

成都网页设计公司