How to grant remote access permissions to mysql server for user?(如何为用户授予对mysql服务器的远程访问权限?)
问题描述
如果我在我的 mysql 数据库中执行 SHOW GRANTS 我得到
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
如果我没记错的话,root@localhost 表示用户root 只能从localhost 访问服务器.我如何告诉 MySQL 授予 root 从其他机器(在同一网络中)访问这个 mysql 服务器的权限?
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?
推荐答案
这会在 *.example.com 中的任何机器上使用相同的密码授予 root 访问权限:
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;
如果名称解析不起作用,您还可以通过 IP 或子网授予访问权限:
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 语法文档.一个>
MySQL GRANT syntax docs.
这篇关于如何为用户授予对mysql服务器的远程访问权限?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何为用户授予对mysql服务器的远程访问权限?
基础教程推荐
- 使用 VBS 和注册表来确定安装了哪个版本和 32 位 2021-01-01
- 如何在 CakePHP 3 中实现 INSERT ON DUPLICATE KEY UPDATE aka upsert? 2021-01-01
- 带有WHERE子句的LAG()函数 2022-01-01
- while 在触发器内循环以遍历 sql 中表的所有列 2022-01-01
- ORA-01830:日期格式图片在转换整个输入字符串之前结束/选择日期查询的总和 2021-01-01
- CHECKSUM 和 CHECKSUM_AGG:算法是什么? 2021-01-01
- MySQL根据从其他列分组的值,对两列之间的值进行求和 2022-01-01
- MySQL 5.7参照时间戳生成日期列 2022-01-01
- 从字符串 TSQL 中获取数字 2021-01-01
- 带更新的 sqlite CTE 2022-01-01
