Mysql 有没有办法在我的sql中更改用户主机
我正在构建一个mysql服务器,只允许用户在使用内部ip地址时访问数据库Mysql 有没有办法在我的sql中更改用户主机,mysql,Mysql,我正在构建一个mysql服务器,只允许用户在使用内部ip地址时访问数据库 SET PASSWORD FOR 'testuser'@'MyIPwillgohere' = PASSWORD('password'); +------------------+-------------+ | user | host | +------------------+-------------+ | testuser | % | |
SET PASSWORD FOR 'testuser'@'MyIPwillgohere' = PASSWORD('password');
+------------------+-------------+
| user | host |
+------------------+-------------+
| testuser | % |
| root | 127.0.0.1 |
| root | ::1 |
| debian-sys-maint | localhost |
| root | localhost |
| root | raspberrypi |
+------------------+-------------+
但是在使用上面的语句时,我得到了以下错误
Can't find any matching row in the user table
我认为这与主机是%而不是本地主机或我的ip地址有关
SET PASSWORD FOR 'testuser'@'MyIPwillgohere' = PASSWORD('password');
+------------------+-------------+
| user | host |
+------------------+-------------+
| testuser | % |
| root | 127.0.0.1 |
| root | ::1 |
| debian-sys-maint | localhost |
| root | localhost |
| root | raspberrypi |
+------------------+-------------+
如何更改主机,或者如何解决此问题。我使用putty SSH连接连接到服务器,并以root用户身份运行mysql
问题是如何更改测试用户主机
我想将主机从%更改为本地主机或我自己的ip地址。我使用workbench以编辑器身份登录,但主机仍然是一样的?您可以尝试类似的方法(但请注意,
DROP
本质上意味着“删除”
”,因此请小心):
我找到了解决我自己问题的办法。它不允许我通过更改密码来更改主机连接的位置
您可以尝试类似的方法(但请注意 表示“删除”,因此请小心): 删除用户“testuser”;将DbNameGoesher.*的使用权授予 'testuser@MyIPwillgohere'由'密码'标识 这样做表明没有找到匹配项。我首先向用户授予特权,并说明他从何处连接,然后更改密码是允许的