如何授予用户的远程访问权限mysql服务器? [英] How to grant remote access permissions to mysql server for user?

查看:469
本文介绍了如何授予用户的远程访问权限mysql服务器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我在我的mysql数据库中 SHOW GRANTS 我获得

 授予所有特权在*。*到'root'@'localhost'
标识为密码'some_characters'
与授予选项

如果我没有错误, root @ localhost 表示用户 root 只能从 localhost 访问服务器。我如何告诉MySQL授予 root 从每个其他机器(在同一网络)访问此mysql服务器的权限?

 授予所有权限*。*至'root'@'%.example.com'
IDENTIFIED BY'some_characters'
与授予期权;
FLUSH PRIVILEGES;

如果名称解析无效,您还可以通过IP或子网授予访问权: p>

 授予所有权限*。*至'root'@'192.168.1.%'
标识符'some_characters'
WITH GRANT OPTION;
FLUSH PRIVILEGES;

MySQL GRANT 语法文档


If I do SHOW GRANTS in my mysql database I get

GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' 
    IDENTIFIED BY PASSWORD 'some_characters' 
    WITH GRANT OPTION

If I am not mistaken, root@localhost means that user root can access the server only from localhost. How do I tell MySQL to grant root the permission to access this mysql server from every other machine (in the same network), too?

解决方案

This grants root access with the same password from any machine in *.example.com:

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%.example.com' 
    IDENTIFIED BY 'some_characters' 
    WITH GRANT OPTION;
FLUSH PRIVILEGES;

If name resolution is not going to work, you may also grant access by IP or subnet:

GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.1.%'
    IDENTIFIED BY 'some_characters'  
    WITH GRANT OPTION;
FLUSH PRIVILEGES;

MySQL GRANT syntax docs.

这篇关于如何授予用户的远程访问权限mysql服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆